-
Notifications
You must be signed in to change notification settings - Fork 8
chore: build.gradle에 flyway 파일명 검증 관련 추가 #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: build.gradle에 flyway 파일명 검증 관련 추가 #393
Conversation
Walkthrough
Estimated code review effort1 (~5 minutes) 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
build.gradle (2)
35-35: 💡 H2 의존성 범위 재검토
runtimeOnly로 두면 운영 Jar에 H2 드라이버가 포함되어 빈번히 보안 스캐너에 걸립니다.- Flyway validate 전용이라면
testRuntimeOnly또는developmentOnly로 스코프를 좁히면 더 안전합니다.-runtimeOnly 'com.h2database:h2' +testRuntimeOnly 'com.h2database:h2'
75-81: ✅ 빌드 파이프라인 조기 실패 설계, 굿!
build·bootJar가flywayValidate에 의존하게 하여 CI 단계에서 즉시 실패하도록 한 점은 환영합니다.
다만, 로컬 개발 시 매번 DB validate가 실행되면 빌드 시간이 길어질 수 있습니다.
1.check태스크에만 의존시키고, 필요 시./gradlew check를 CI에서 호출하는 대안도 고려해 보세요.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
build.gradle(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
|
|
||
| flyway { | ||
| url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1' | ||
| user = 'sa' | ||
| password = '' | ||
| locations = ['filesystem:src/main/resources/db/migration'] | ||
| validateMigrationNaming = true | ||
| ignoreMigrationPatterns = ['*:pending'] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
❗ Flyway DSL 설정 세부 검토 필요
- Gradle 플러그인 JVM이 H2 드라이버를 못 찾을 경우
url만 지정하면 실패합니다.flyway.driver = 'org.h2.Driver'를 명시하거나buildscript { dependencies }로 드라이버를 추가해 주세요. ignoreMigrationPatterns는 문자열 CSV를 기대하기 때문에 리스트 사용 시 플러그인 버전에 따라 무시될 수 있습니다.- 마이그레이션 위치를 모듈화한 경우, 멀티모듈 경로도 배열로 추가해 두면 재사용성이 올라갑니다.
flyway {
url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1'
user = 'sa'
password = ''
- locations = ['filesystem:src/main/resources/db/migration']
- validateMigrationNaming = true
- ignoreMigrationPatterns = ['*:pending']
+ driver = 'org.h2.Driver'
+ locations = [
+ 'filesystem:src/main/resources/db/migration'
+ ]
+ validateMigrationNaming = true
+ ignoreMigrationPatterns = '*:pending'
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| flyway { | |
| url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1' | |
| user = 'sa' | |
| password = '' | |
| locations = ['filesystem:src/main/resources/db/migration'] | |
| validateMigrationNaming = true | |
| ignoreMigrationPatterns = ['*:pending'] | |
| } | |
| flyway { | |
| url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1' | |
| user = 'sa' | |
| password = '' | |
| driver = 'org.h2.Driver' | |
| locations = [ | |
| 'filesystem:src/main/resources/db/migration' | |
| ] | |
| validateMigrationNaming = true | |
| ignoreMigrationPatterns = '*:pending' | |
| } |
🤖 Prompt for AI Agents
In build.gradle around lines 87 to 95, the Flyway configuration needs
adjustments: explicitly set flyway.driver to 'org.h2.Driver' to ensure the H2
driver is found; change ignoreMigrationPatterns from a list to a comma-separated
string to avoid plugin version issues; and if using a multi-module setup, update
locations to an array including all relevant module migration paths for better
reusability.
nayonsoso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
선 approve 합니다~
코멘트 단 부분들 고려해주세요!
build.gradle
Outdated
| tasks.named('build') { | ||
| dependsOn 'flywayValidate' | ||
| } | ||
|
|
||
| tasks.named('bootJar') { | ||
| dependsOn 'flywayValidate' | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
성혁님 혹시 75-81 라인을 88번의 flyway 블럭 밑으로 내리고
지금의 87번과 88번 사이에 // build 단계에서 flyway 검증 주석을 넣는 것 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
가독성 측면에서 말씀하신 부분이 더 나은 것 같아 적용했습니다 !
관련 이슈
작업 내용
기존에는 flyway의 파일명, 체크섬 등과 같은 유효성 검사가 런타임에 수행되었습니다. 마이그레이션 파일명 오타는 리뷰 시 놓치기 쉽지만 치명적인 결과를 초래하기에 이를 CI 단계에서 발견하도록
build.gradle을 수정합니다.flyway플러그인을 추가해flywayValidate태스크를 사용하도록 하였고, 빌드 전flywayValidate를 수행하도록 하였습니다.CI 단계에서 사용할 가상의 DB가 있어야 하기 때문에 임시로 H2 데이터베이스를 생성합니다.
특이 사항
파일명 오타를 발견하면 위와 같은 오류 메시지가 출력됩니다.
리뷰 요구사항 (선택)