-
Notifications
You must be signed in to change notification settings - Fork 2
fix: jar 실행 시 프로젝트 루트 경로로 이동하도록 수정 #212
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
Conversation
- env 인식하기 위함
📝 WalkthroughWalkthrough스크립트가 이제 후속 명령을 실행하기 전에 현재 작업 디렉터리를 프로젝트 루트 디렉터리( Changes
Estimated code review effort1 (<10분) ✨ Finishing Touches
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
Documentation and Community
|
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: 1
🔭 Outside diff range comments (1)
scripts/start.sh (1)
32-37: 와일드카드 복사 시 다중 JAR 매칭 및 변수 따옴표 미사용
build/libs/*.jar가 여러 개 매칭되면cp가 실패하거나 예기치 않은 파일이 덮어써질 수 있습니다.
- 가장 최근 빌드 산출물 한 개만 복사하도록 명시하거나, 파일 개수를 검증한 뒤 처리하는 로직이 필요합니다.
경로 변수에 따옴표가 없어 공백·특수문자 포함 시 오동작할 수 있습니다.
예시 개선안:
-cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE +LATEST_JAR=$(ls -t "$PROJECT_ROOT"/build/libs/*.jar | head -n1) +cp "$LATEST_JAR" "$JAR_FILE"필요 시
ls사용 대신find -type f -name '*.jar' -print0 | xargs -0 ls -t | head -n1등으로 안전성을 높일 수 있습니다.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
scripts/start.sh(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
scripts/start.sh
[warning] 26-26: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
(SC2164)
| ERROR_LOG="$PROJECT_ROOT/error.log" | ||
| DEPLOY_LOG="$PROJECT_ROOT/deploy.log" | ||
|
|
||
| cd $PROJECT_ROOT |
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.
cd 실패 시 무조건 다음 단계로 진행되어 배포가 실패할 수 있음
cd $PROJECT_ROOT 명령이 실패해도 스크립트가 계속 실행되어 잘못된 경로에서 cp / java -jar가 수행될 위험이 있습니다.
ShellCheck 경고(SC2164)도 동일한 문제를 지적합니다. 실패 시 즉시 종료하도록 수정해 주세요.
-cd $PROJECT_ROOT
+cd "$PROJECT_ROOT" || {
+ echo "프로젝트 루트($PROJECT_ROOT)로 이동하지 못했습니다." >&2
+ exit 1
+}📝 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.
| cd $PROJECT_ROOT | |
| cd "$PROJECT_ROOT" || { | |
| echo "프로젝트 루트($PROJECT_ROOT)로 이동하지 못했습니다." >&2 | |
| exit 1 | |
| } |
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 26-26: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
(SC2164)
🤖 Prompt for AI Agents
In scripts/start.sh at line 26, the cd command to $PROJECT_ROOT may fail but the
script continues running, risking subsequent commands running in the wrong
directory. Modify the script to check if cd succeeds and immediately exit if it
fails, ensuring the deployment does not proceed on an incorrect path.
⭐ Summary
📌 Tasks