Skip to content

Commit ed539e2

Browse files
authored
Merge branch 'develop' into main
2 parents 014b6db + 3cbd316 commit ed539e2

13 files changed

Lines changed: 554 additions & 61 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
*
44

5-
- close #이슈번호
65

76
---
87

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import os
2+
import subprocess
3+
4+
def get_flyway_files(branch):
5+
# 브랜치 체크아웃
6+
subprocess.run(['git', 'checkout', branch], check=True)
7+
# db 디렉토리에서 파일 목록 가져오기
8+
db_path = os.path.join(os.getcwd(), 'src/main/resources/db/migration')
9+
files = os.listdir(db_path)
10+
# Flyway 파일 추출 및 정렬
11+
flyway_files = sorted([f for f in files if f.startswith('V')])
12+
return flyway_files
13+
14+
def extract_version_and_name(file_name):
15+
version, name = file_name.split('__', 1)
16+
return version, name
17+
18+
def main():
19+
20+
# 현재 브랜치의 Flyway 파일 가져오기
21+
current_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip().decode('utf-8')
22+
pr_files = get_flyway_files(current_branch)
23+
24+
# 메인 브랜치의 Flyway 파일 가져오기
25+
main_files = get_flyway_files('develop')
26+
main_versions = {}
27+
for file_name in main_files:
28+
version, name = extract_version_and_name(file_name)
29+
main_versions[version] = name
30+
31+
conflict_versions = []
32+
for file_name in pr_files:
33+
version, name = file_name.split('__', 1)
34+
35+
if version in main_versions and name != main_versions[version]:
36+
conflict_versions.append(file_name)
37+
38+
if conflict_versions:
39+
print(f"Error: Version conflict(s) found for versions: {', '.join(conflict_versions)}")
40+
exit(1)
41+
else:
42+
print("No version conflicts found.")
43+
44+
if __name__ == "__main__":
45+
main()

.github/workflows/deploy-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
docker exec -e MYSQL_PWD="$MYSQL_PASSWORD" "$MYSQL_CONTAINER" \
9494
mysqldump --no-tablespaces -u"$MYSQL_USERNAME" "$MYSQL_DATABASE" > "$DUMP_FILE"
9595
96-
find "$BACKUP_DIR" -type f -name '*.sql' -mtime +5 -delete
96+
find "$BACKUP_DIR" -type f -name '*.sql' -mtime +30 -delete
9797
9898
- name: Deploy to prod server
9999
uses: appleboy/ssh-action@v0.1.8
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Flyway Version Validator
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
check-flyway-version:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
13+
- name: Fetch all branches
14+
run: git fetch --all
15+
16+
- name: Run Flyway version check
17+
run: python .github/SCRIPT/check_flyway_version.py

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ dependencies {
6464
implementation platform('software.amazon.awssdk:bom:2.41.14')
6565
implementation 'software.amazon.awssdk:s3'
6666

67+
// 이미지 WEBP 변환
68+
implementation 'com.sksamuel.scrimage:scrimage-core:4.3.2'
69+
implementation 'com.sksamuel.scrimage:scrimage-webp:4.3.2'
70+
implementation 'com.twelvemonkeys.imageio:imageio-jpeg:3.13.1'
71+
6772
// monitoring
6873
implementation 'io.micrometer:micrometer-registry-prometheus'
6974

scripts/code-formatting.sh

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,18 @@ target_java_files=()
1212
target_mode="staged"
1313
pre_format_snapshot=""
1414

15+
canonicalize_path() {
16+
local input_path="$1"
17+
local dir_path
18+
local base_name
19+
20+
dir_path="$(cd "$(dirname "$input_path")" && pwd -P)" || return 1
21+
base_name="$(basename "$input_path")"
22+
printf '%s/%s\n' "$dir_path" "$base_name"
23+
}
24+
1525
resolve_target_java_file() {
1626
local input_file="$1"
17-
local candidate_path=""
1827
local resolved_file=""
1928
local matched_files=""
2029
local match_count
@@ -25,11 +34,20 @@ resolve_target_java_file() {
2534
esac
2635

2736
if [ -f "$input_file" ]; then
28-
candidate_path="$input_file"
37+
resolved_file="$(canonicalize_path "$input_file")" || {
38+
echo "[오류] 파일 경로를 정규화할 수 없습니다: $input_file" >&2
39+
return 1
40+
}
2941
elif [ -f "$invocation_dir/$input_file" ]; then
30-
candidate_path="$invocation_dir/$input_file"
42+
resolved_file="$(canonicalize_path "$invocation_dir/$input_file")" || {
43+
echo "[오류] 파일 경로를 정규화할 수 없습니다: $input_file" >&2
44+
return 1
45+
}
3146
elif [ -f "$repo_root/$input_file" ]; then
32-
candidate_path="$repo_root/$input_file"
47+
resolved_file="$(canonicalize_path "$repo_root/$input_file")" || {
48+
echo "[오류] 파일 경로를 정규화할 수 없습니다: $input_file" >&2
49+
return 1
50+
}
3351
else
3452
matched_files="$(git ls-files -- "$input_file" "*/$input_file" 2>/dev/null || true)"
3553
if [ -z "$matched_files" ]; then
@@ -43,11 +61,10 @@ resolve_target_java_file() {
4361
return 1
4462
fi
4563

46-
candidate_path="$repo_root/$matched_files"
47-
fi
48-
49-
if [ -n "$candidate_path" ]; then
50-
resolved_file="$(cd "$(dirname "$candidate_path")" && pwd -P)/$(basename "$candidate_path")"
64+
resolved_file="$(canonicalize_path "$repo_root/$matched_files")" || {
65+
echo "[오류] 파일 경로를 정규화할 수 없습니다: $input_file" >&2
66+
return 1
67+
}
5168
fi
5269

5370
case "$resolved_file" in
@@ -448,3 +465,4 @@ else
448465
echo "[완료] 지정된 Java 파일에 변경할 내용이 없습니다."
449466
fi
450467
fi
468+

0 commit comments

Comments
 (0)