Skip to content

Conversation

@Jjiggu
Copy link
Contributor

@Jjiggu Jjiggu commented Jun 30, 2025

작업 요약

CI/CD 자동 배포 구축

Issue Link

#3

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능
    • 관리자 전용 배포 스크립트(start-admin.sh, stop-admin.sh) 및 배포 설정 파일(appspec-admin.yml) 추가로 관리자 서비스의 배포 자동화 지원.
    • 사용자 서비스용 시작 및 중지 스크립트(start-user.sh, stop-user.sh) 추가.
  • 개선 사항
    • 관리자 서비스만을 위한 CI/CD 워크플로우가 별도로 분리 및 최적화됨.
    • Gradle 빌드 설정이 실행 모듈과 라이브러리 모듈을 구분하여 빌드 효율성 향상.
    • Gradle 스크립트의 코드 포맷이 개선됨.
  • 테스트
    • 불필요한 기본 테스트 클래스가 삭제됨.

@Jjiggu Jjiggu self-assigned this Jun 30, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 30, 2025

Walkthrough

이번 변경에서는 Admin 서비스의 배포를 위한 별도의 GitHub Actions 워크플로우와 앱 배포 스크립트, 앱스펙 파일이 추가되고, Gradle 빌드 설정이 Admin/User 실행 모듈과 라이브러리 모듈을 구분하여 빌드하도록 개선되었습니다. 기존의 불필요한 테스트 파일도 삭제되었습니다.

Changes

파일/경로 변경 요약
.github/workflows/deploy-admin.yml Admin 전용 배포 워크플로우 신설, 트리거/환경변수/빌드/배포 스크립트 및 S3 경로/그룹 분리, 배포 패키징 개선
appspec-admin.yml Admin 서비스 배포를 위한 AppSpec 파일 신설, 파일 복사/권한/라이프사이클 후크(Stop/Start 스크립트) 지정
scripts/start-admin.sh, scripts/stop-admin.sh Admin 서비스용 실행/중지 스크립트 신설, 로그 관리 및 프로세스 제어 구현
scripts/start-user.sh, scripts/stop-user.sh User 서비스용 실행/중지 스크립트 신설, 로그 관리 및 프로세스 제어 구현
build.gradle 실행 모듈(Admin/User)과 라이브러리 모듈 구분 빌드 로직 도입, bootJar/jar 활성화 조건부 처리
common/build.gradle jar/bootJar 태스크 설정 포맷 및 순서 정리(기능 변화 없음)
domain-token/src/test/java/com/nowait/token/DomainTokenApplicationTests.java 불필요한 Spring Boot context load 테스트 클래스 삭제

Sequence Diagram(s)

sequenceDiagram
    participant DevOps as GitHub Actions
    participant Gradle as Gradle Build
    participant S3 as AWS S3
    participant CodeDeploy as AWS CodeDeploy
    participant EC2 as EC2(Admin 서버)
    participant Script as start/stop-admin.sh

    DevOps->>Gradle: admin bootJar 빌드
    Gradle-->>DevOps: admin JAR 생성
    DevOps->>DevOps: 배포 패키지(zip) 생성 (admin JAR, start/stop 스크립트, appspec-admin.yml)
    DevOps->>S3: 배포 zip 업로드 (admin division 경로)
    DevOps->>CodeDeploy: 배포 생성 요청(admin 그룹, S3 경로)
    CodeDeploy->>EC2: 배포 명령(appspec-admin.yml 전달)
    EC2->>Script: stop-admin.sh 실행(AfterInstall)
    Script-->>EC2: 기존 프로세스 종료
    EC2->>Script: start-admin.sh 실행(ApplicationStart)
    Script-->>EC2: 새 admin 서비스 기동
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot requested a review from HyemIin June 30, 2025 09:22
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🔭 Outside diff range comments (1)
scripts/start-admin.sh (1)

18-26: PID 로깅 시점이 잘못되었습니다
SERVICE_PID실행 전에 구하기 때문에 항상 이전 프로세스 PID(또는 빈값)를 기록합니다. 실행 직후 $! 로 갱신하세요.

- SERVICE_PID=$(pgrep -f ${APP_NAME}.*.jar) # 실행중인 Spring 서버의 PID
+nohup java -Xms256m -Xmx512m -XX:+UseG1GC -jar "$JAR_PATH" --spring.profiles.active=admin > "$APP_LOG" 2> "$ERROR_LOG" &
+SERVICE_PID=$!

또한 pgrep 패턴에 점(.) 이 정규식으로 해석되므로 .*\.jar 처럼 이스케이프하는 것이 안전합니다.

🧹 Nitpick comments (9)
build.gradle (2)

15-17: Spring Boot 플러그인 적용이 과도하게 중복됩니다
subprojects 블록 시작 직후 모든 모듈에 org.springframework.boot 플러그인을 일괄 적용한 뒤, 아래 if 분기에서 다시 동일 플러그인을 적용하고 있습니다. 두 번 호출해도 Gradle 이슈는 없지만 의도 파악이 어려워지고 유지보수자가 “왜 두 번인가?”를 고민하게 됩니다.
불필요한 중복을 제거하거나, 실행 모듈에만 플러그인을 적용하도록 상단 apply plugin: 'org.springframework.boot' 라인을 지우는 편이 더 명확합니다.


21-33: 하드코딩된 실행 모듈 리스트는 확장성에 취약합니다
applicationModules = ['application-admin', 'application-user'] 배열을 직접 관리하면, 새 실행 모듈이 추가될 때마다 이 스크립트를 수정해야 합니다.

예) application-pos 모듈 추가 시 빌드·배포가 즉시 깨집니다.

project(':').subprojects.findAll { it.name.startsWith('application-') } 처럼 규칙 기반 자동 탐색을 적용하거나, Gradle property(예: -Pbootable=true)로 모듈별 플래그를 주는 방식을 고려해 보세요.

common/build.gradle (1)

1-6: 루트 스크립트와 중복된 jar/bootJar 설정
루트 build.gradle에서 이미 비-실행 모듈에 대해 bootJar { enabled = false }, jar { enabled = true } 로 처리하므로, common 모듈에서 동일 설정을 반복할 필요가 없습니다. 중복 정의는 설정 충돌의 여지를 남깁니다.
필요 없다면 삭제하고 루트 설정에만 의존하는 것을 권장합니다.

scripts/stop-admin.sh (2)

3-9: JAR 선택 로직 개선 및 불필요 변수 제거 제안

  • ls | grep 파이프는 공백·특수문자 파일명에서 깨질 수 있습니다. JAR_NAME=$(ls "$REPOSITORY"/build/libs/*.jar | tail -n 1 | xargs -n1 basename) 혹은 for-loop 글로빙이 안전합니다.
  • JAR_PATH 변수를 선언했지만 이후 사용하지 않습니다(SC2034). 제거하거나 활용 코드를 추가하세요.
  • cd $REPOSITORY 후 실패 체크(|| exit 1)를 넣어 배포 디렉터리 변경 실패 상황을 대비하십시오.

15-18: 로그 메시지 오탈자
"서비스 NouFound""서비스 NotFound" 가 의도된 표현으로 보입니다.

scripts/start-admin.sh (1)

3-9: ls | grep 사용 대신 글로빙으로 간단화 가능

JAR_NAME=$(ls "$REPOSITORY"/build/libs/*.jar | tail -n 1 | xargs -n1 basename)

또는

for f in "$REPOSITORY"/build/libs/*.jar; do JAR_NAME=$(basename "$f"); done

글로빙은 공백/특수문자 파일명에도 안전하며 grep 의존을 제거합니다.

appspec-admin.yml (1)

4-13: 배포 아카이브 전체 루트 복사는 용량·보안 리스크가 큽니다
source: / 는 CI 산출물의 모든 파일(.git, 테스트 리소스 등) 을 EC2 로 전송합니다. 필요 파일(관리 JAR, 스크립트, 설정)만 포함하도록 source: build/libs, source: scripts, source: appspec-admin.yml 등의 최소 경로 지정이 네트워크 비용과 노출면을 줄입니다.

같은 이유로 permissions.object/ 보단 /home/ubuntu/spring-github-action 처럼 목적 디렉터리로 한정하는 편이 안전합니다.

.github/workflows/deploy-admin.yml (2)

66-66: Shell 변수 확장 시 따옴표 누락 (SC2086)

ShellCheck 경고대로 변수에 공백·글로빙 위험이 있으니 모든 변수 확장을 쌍따옴표로 감싸 주세요.

-run: aws deploy push --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --ignore-hidden-files --s3-location s3://$AWS_S3_BUCKET/$PROJECT_NAME/$DIVISION/$GITHUB_SHA.zip --source .
+run: aws deploy push --application-name "${{ env.AWS_CODE_DEPLOY_APPLICATION }}" --ignore-hidden-files --s3-location "s3://${{ env.AWS_S3_BUCKET }}/${{ env.PROJECT_NAME }}/${{ env.DIVISION }}/${{ github.sha }}.zip" --source .

74-75: CodeDeploy S3 위치에도 따옴표 누락

위와 동일하게 변수 확장을 모두 따옴표로 감싸는 편이 안전합니다.

-        --s3-location bucket=${{ env.AWS_S3_BUCKET }},key=${{ env.PROJECT_NAME }}/${{ env.DIVISION }}/${{ github.sha }}.zip,bundleType=zip
+        --s3-location "bucket=${{ env.AWS_S3_BUCKET }},key=${{ env.PROJECT_NAME }}/${{ env.DIVISION }}/${{ github.sha }}.zip,bundleType=zip"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ce2fd7 and 3183a5d.

📒 Files selected for processing (7)
  • .github/workflows/deploy-admin.yml (3 hunks)
  • appspec-admin.yml (1 hunks)
  • build.gradle (1 hunks)
  • common/build.gradle (1 hunks)
  • domain-token/src/test/java/com/nowait/token/DomainTokenApplicationTests.java (0 hunks)
  • scripts/start-admin.sh (1 hunks)
  • scripts/stop-admin.sh (1 hunks)
💤 Files with no reviewable changes (1)
  • domain-token/src/test/java/com/nowait/token/DomainTokenApplicationTests.java
🧰 Additional context used
🪛 Shellcheck (0.10.0)
scripts/stop-admin.sh

[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 7-7: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.

(SC2010)


[warning] 8-8: JAR_PATH appears unused. Verify use (or export if used externally).

(SC2034)

scripts/start-admin.sh

[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 7-7: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.

(SC2010)

🪛 YAMLlint (1.37.1)
.github/workflows/deploy-admin.yml

[error] 5-5: trailing spaces

(trailing-spaces)


[warning] 8-8: wrong indentation: expected 4 but found 6

(indentation)


[error] 46-46: trailing spaces

(trailing-spaces)

🪛 actionlint (1.7.7)
.github/workflows/deploy-admin.yml

66-66: shellcheck reported issue in this script: SC2086:info:1:116: Double quote to prevent globbing and word splitting

(shellcheck)


66-66: shellcheck reported issue in this script: SC2086:info:1:131: Double quote to prevent globbing and word splitting

(shellcheck)


66-66: shellcheck reported issue in this script: SC2086:info:1:145: Double quote to prevent globbing and word splitting

(shellcheck)


66-66: shellcheck reported issue in this script: SC2086:info:1:155: Double quote to prevent globbing and word splitting

(shellcheck)

JAR_PATH=$REPOSITORY/build/libs/$JAR_NAME
STOP_LOG="$REPOSITORY/stop.log"

$ chmod 666 STOP_LOG
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

$ chmod 구문 오류 – 스크립트가 즉시 실패합니다
쉘에서 $ 는 변수 참조를 의미합니다. $ chmod 666 STOP_LOG“빈 변수 이름” 으로 해석되어 command not found 오류가 납니다.

-$ chmod 666 STOP_LOG
+chmod 666 "$STOP_LOG"

동일 패턴이 start-script에도 존재하니 함께 수정 바랍니다.

📝 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.

Suggested change
$ chmod 666 STOP_LOG
chmod 666 "$STOP_LOG"
🤖 Prompt for AI Agents
In scripts/stop-admin.sh at line 11, the command incorrectly uses a leading '$'
before chmod, causing a "command not found" error because '$' is for variable
expansion. Remove the leading '$' so the line reads 'chmod 666 STOP_LOG'. Also,
check the start-script file for the same issue and fix it similarly by removing
any leading '$' before commands.

Comment on lines +7 to +16
paths:
- 'application-admin/**'
- 'common/**'
- 'domain-*/**'
- 'application-config/**'
- 'security-admin/**'
- 'build.gradle'
- 'settings.gradle'
- 'gradle/**'

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

잘못된 들여쓰기 및 공백으로 YAMLLint 오류 발생

paths: 이하의 들여쓰기가 4칸이 아니라 6칸으로 되어 있어 YAML 구문 오류(trailing-spaces / indentation)가 보고되었습니다. CI/CD 워크플로우가 아예 로드되지 않을 수 있으니 반드시 수정해 주세요.

-    paths:
-      - 'application-admin/**'
-      - 'common/**'
-      - 'domain-*/**'
-      - 'application-config/**'
-      - 'security-admin/**'
-      - 'build.gradle'
-      - 'settings.gradle'
-      - 'gradle/**'
+    paths:
+      - 'application-admin/**'
+      - 'common/**'
+      - 'domain-*/**'
+      - 'application-config/**'
+      - 'security-admin/**'
+      - 'build.gradle'
+      - 'settings.gradle'
+      - 'gradle/**'

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 8-8: wrong indentation: expected 4 but found 6

(indentation)

🤖 Prompt for AI Agents
In .github/workflows/deploy-admin.yml around lines 7 to 16, the indentation
under the 'paths:' key is incorrect with 6 spaces instead of the required 4
spaces, causing YAML syntax errors. Fix this by adjusting the indentation of all
lines under 'paths:' to use exactly 4 spaces, and remove any trailing spaces to
comply with YAML linting rules and ensure the workflow loads correctly.

@Jjiggu Jjiggu merged commit 2d744a7 into develop Jun 30, 2025
1 check was pending
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🔭 Outside diff range comments (1)
scripts/start-user.sh (1)

18-26: PID 로깅 시점이 잘못됨

SERVICE_PID 는 실행 전 프로세스를 찾고 있어 새로 기동된 PID 가 기록되지 않습니다. nohup 실행 후 $! 를 사용해 실제 PID 를 기록하세요.

-SERVICE_PID=$(pgrep -f ${APP_NAME}.*.jar) # 실행중인 Spring 서버의 PID
+SERVICE_PID=$(pgrep -f "${APP_NAME}.*.jar") # 기존 프로세스 PID
 ...
-nohup java ... &
-
-echo "[$NOW] > 서비스 PID: $SERVICE_PID" >> $START_LOG
+nohup java -Xms256m -Xmx512m -XX:+UseG1GC -jar "$JAR_PATH" --spring.profiles.active=user \
+  >> "$APP_LOG" 2>> "$ERROR_LOG" &
+NEW_PID=$!
+echo "[$NOW] > 서비스 PID: $NEW_PID" >> "$START_LOG"
♻️ Duplicate comments (3)
scripts/stop-admin.sh (1)

11-11: $ chmod 문법 오류 – 실행 불가
기존 리뷰에서 이미 지적된 항목입니다. $ 기호를 제거하고 변수에 따옴표를 감싸 주세요.

-$ chmod 666 "$STOP_LOG"
+chmod 666 "$STOP_LOG"
scripts/start-admin.sh (2)

14-16: chmod 문법 오류 – 이전 리뷰와 동일

-$ chmod 666 "$START_LOG"
-$ chmod 666 "$ERROR_LOG"
-$ chmod 666 "$APP_LOG"
+chmod 666 "$START_LOG"
+chmod 666 "$ERROR_LOG"
+chmod 666 "$APP_LOG"

4-4: cd 실패 시 처리 필요
동일 패턴으로 수정 권장.

🧹 Nitpick comments (6)
scripts/stop-admin.sh (3)

7-8: ls | grep 패턴 대신 글로브 사용 권장

ls | grep '.jar' 는 공백·특수문자가 포함된 파일명에서 문제를 일으킬 수 있습니다. 단순 글로브가 더 안전합니다.

-JAR_NAME=$(ls $REPOSITORY/build/libs/ | grep '.jar' | tail -n 1)
+JAR_NAME=$(echo "$REPOSITORY"/build/libs/*.jar | xargs -n1 basename | tail -n1)

15-15: 변수 확장 시 따옴표 누락

[ -z $CURRENT_PID ] 는 PID 가 비어 있을 때 공백이 확장돼 오류를 유발할 수 있습니다.

-if [ -z $CURRENT_PID ]
+if [ -z "$CURRENT_PID" ]

17-17: 오타: NouFoundNotFound

로그 메시지 오타를 수정해 주세요.

-  echo "서비스 NouFound" >> $STOP_LOG
+  echo "서비스 NotFound" >> "$STOP_LOG"
scripts/stop-user.sh (1)

4-4: cd 실패 시 처리 누락

관리자 스크립트와 동일한 이유로 실패 시 종료 로직을 추가하세요.

-cd $REPOSITORY
+cd "$REPOSITORY" || { echo "디렉터리 이동 실패"; exit 1; }
scripts/start-user.sh (1)

4-4: cd 실패 시 종료 처리 필요

-cd $REPOSITORY
+cd "$REPOSITORY" || { echo "디렉터리 이동 실패"; exit 1; }
.github/workflows/deploy-admin.yml (1)

30-37: 액션 버전 최신화 권장

actions/checkout@v4, actions/setup-java@v4 로 업데이트하면 향후 보안 패치 혜택을 받을 수 있습니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3183a5d and c787006.

📒 Files selected for processing (5)
  • .github/workflows/deploy-admin.yml (1 hunks)
  • scripts/start-admin.sh (1 hunks)
  • scripts/start-user.sh (1 hunks)
  • scripts/stop-admin.sh (1 hunks)
  • scripts/stop-user.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
scripts/start-user.sh

[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 7-7: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.

(SC2010)

scripts/stop-user.sh

[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 7-7: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.

(SC2010)


[warning] 8-8: JAR_PATH appears unused. Verify use (or export if used externally).

(SC2034)

scripts/start-admin.sh

[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 7-7: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.

(SC2010)

scripts/stop-admin.sh

[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 7-7: Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.

(SC2010)


[warning] 8-8: JAR_PATH appears unused. Verify use (or export if used externally).

(SC2034)

🪛 actionlint (1.7.7)
.github/workflows/deploy-admin.yml

30-30: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


33-33: the runner of "actions/setup-java@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


60-60: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.37.1)
.github/workflows/deploy-admin.yml

[error] 5-5: trailing spaces

(trailing-spaces)


[warning] 8-8: wrong indentation: expected 4 but found 6

(indentation)


[error] 24-24: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 37-37: trailing spaces

(trailing-spaces)


[error] 42-42: trailing spaces

(trailing-spaces)


[error] 46-46: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)


[error] 65-65: trailing spaces

(trailing-spaces)


[warning] 82-82: too many blank lines

(3 > 0) (empty-lines)

🔇 Additional comments (1)
.github/workflows/deploy-admin.yml (1)

5-15: 들여쓰기·공백 오류 다수

YAMLLint 경고(잘못된 들여쓰기, trailing space)가 여전히 남아 있습니다. CI 로드 실패를 방지하려면 공백을 제거하고 paths: 이하를 4칸 들여쓰기로 맞춰 주세요.

#!/bin/bash

REPOSITORY=/home/ubuntu/spring-github-action
cd $REPOSITORY
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

cd 실패 시 즉시 종료 처리 필요

cd $REPOSITORY 가 실패하면 이후 모든 명령이 잘못된 경로에서 실행됩니다. 실패 여부를 체크해 스크립트를 종료하도록 수정해 주세요.

-cd $REPOSITORY
+cd "$REPOSITORY" || { echo "디렉터리 이동 실패"; 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.

Suggested change
cd $REPOSITORY
cd "$REPOSITORY" || { echo "디렉터리 이동 실패"; exit 1; }
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 4-4: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🤖 Prompt for AI Agents
In scripts/stop-admin.sh at line 4, the script changes directory to $REPOSITORY
without checking if the command succeeds. Modify the script to check the exit
status of the cd command and immediately exit the script if cd fails, preventing
subsequent commands from running in the wrong directory.

REPOSITORY=/home/ubuntu/spring-github-action
cd $REPOSITORY

APP_NAME=application-admin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

잘못된 APP_NAME 지정

user 서비스 스크립트에서 application-admin 을 사용하고 있습니다.

-APP_NAME=application-admin
+APP_NAME=application-user
🤖 Prompt for AI Agents
In scripts/stop-user.sh at line 6, the APP_NAME is incorrectly set to
'application-admin' which is not the correct service name for the user service.
Change the APP_NAME variable to the correct user service name to ensure the
script targets the right application.

JAR_PATH=$REPOSITORY/build/libs/$JAR_NAME
STOP_LOG="$REPOSITORY/stop.log"

$ chmod 666 STOP_LOG
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

chmod 문법 오류 및 변수 미사용

  1. $ chmod 로 명령이 실패합니다.
  2. 변수 대신 문자열 STOP_LOG 를 사용하고 있습니다.
-$ chmod 666 STOP_LOG
+chmod 666 "$STOP_LOG"
🤖 Prompt for AI Agents
In scripts/stop-user.sh at line 11, the chmod command is incorrectly prefixed
with a dollar sign and uses the literal string STOP_LOG instead of the variable.
Remove the dollar sign before chmod and replace the string STOP_LOG with the
appropriate variable name that holds the log file path to fix the syntax error
and correctly reference the variable.

Comment on lines +15 to +17
if [ -z $CURRENT_PID ]
then
echo "서비스 NouFound" >> $STOP_LOG
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

PID 체크 구문에 따옴표 필요 + 오타

[ -z "$CURRENT_PID" ] 로 수정하고, 오타 NouFound 도 함께 고쳐 주세요.

-if [ -z $CURRENT_PID ]
-then
-  echo "서비스 NouFound" >> $STOP_LOG
+if [ -z "$CURRENT_PID" ]; then
+  echo "서비스 NotFound" >> "$STOP_LOG"
📝 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.

Suggested change
if [ -z $CURRENT_PID ]
then
echo "서비스 NouFound" >> $STOP_LOG
if [ -z "$CURRENT_PID" ]; then
echo "서비스 NotFound" >> "$STOP_LOG"
🤖 Prompt for AI Agents
In scripts/stop-user.sh around lines 15 to 17, the PID check condition lacks
quotes around the variable, which can cause errors if the variable is empty or
contains spaces. Update the condition to use quotes like [ -z "$CURRENT_PID" ].
Also, fix the typo in the echo statement by changing "서비스 NouFound" to the
correct spelling.

REPOSITORY="/home/ubuntu/spring-github-action"
cd $REPOSITORY

APP_NAME=application-admin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

APP_NAME 오타 – admin 모듈을 기동하게 됨

user 서비스용 스크립트에서 admin 이름을 사용하고 있습니다.

-APP_NAME=application-admin
+APP_NAME=application-user
🤖 Prompt for AI Agents
In scripts/start-user.sh at line 6, the APP_NAME variable is incorrectly set to
"application-admin" which starts the admin module instead of the user service.
Change the value of APP_NAME to the correct user service module name to ensure
the script starts the intended service.

Comment on lines +14 to +16
$ chmod 666 $START_LOG
$ chmod 666 ERROR_LOG
$ chmod 666 APP_LOG
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

chmod 명령어 문법 오류
기존 리뷰와 동일한 문제입니다.

-$ chmod 666 $START_LOG
-$ chmod 666 ERROR_LOG
-$ chmod 666 APP_LOG
+chmod 666 "$START_LOG"
+chmod 666 "$ERROR_LOG"
+chmod 666 "$APP_LOG"
📝 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.

Suggested change
$ chmod 666 $START_LOG
$ chmod 666 ERROR_LOG
$ chmod 666 APP_LOG
chmod 666 "$START_LOG"
chmod 666 "$ERROR_LOG"
chmod 666 "$APP_LOG"
🤖 Prompt for AI Agents
In scripts/start-user.sh around lines 14 to 16, the chmod commands have a syntax
error because ERROR_LOG and APP_LOG variables are missing the $ prefix. Fix this
by adding $ before ERROR_LOG and APP_LOG to correctly reference the variables as
$ERROR_LOG and $APP_LOG.

Comment on lines +18 to +25
SERVICE_PID=$(pgrep -f ${APP_NAME}.*.jar) # 실행중인 Spring 서버의 PID
NOW=$(date +%c)


echo "[$NOW] > $JAR_PATH 실행" >> $START_LOG
nohup java -Xms256m -Xmx512m -XX:+UseG1GC -jar $JAR_PATH --spring.profiles.active=admin > $APP_LOG 2> $ERROR_LOG &

echo "[$NOW] > 서비스 PID: $SERVICE_PID" >> $START_LOG
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

새 PID 로깅 누락

admin 스크립트 역시 기동 후 $! 로 새 PID 를 기록해야 합니다.

-SERVICE_PID=$(pgrep -f ${APP_NAME}.*.jar)
 ...
-nohup java -Xms256m -Xmx512m -XX:+UseG1GC -jar $JAR_PATH --spring.profiles.active=admin > $APP_LOG 2> $ERROR_LOG &
-
-echo "[$NOW] > 서비스 PID: $SERVICE_PID" >> $START_LOG
+nohup java -Xms256m -Xmx512m -XX:+UseG1GC -jar "$JAR_PATH" --spring.profiles.active=admin \
+  >> "$APP_LOG" 2>> "$ERROR_LOG" &
+NEW_PID=$!
+echo "[$NOW] > 서비스 PID: $NEW_PID" >> "$START_LOG"
📝 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.

Suggested change
SERVICE_PID=$(pgrep -f ${APP_NAME}.*.jar) # 실행중인 Spring 서버의 PID
NOW=$(date +%c)
echo "[$NOW] > $JAR_PATH 실행" >> $START_LOG
nohup java -Xms256m -Xmx512m -XX:+UseG1GC -jar $JAR_PATH --spring.profiles.active=admin > $APP_LOG 2> $ERROR_LOG &
echo "[$NOW] > 서비스 PID: $SERVICE_PID" >> $START_LOG
# (remove the old pgrep-based PID lookup)
# SERVICE_PID=$(pgrep -f ${APP_NAME}.*.jar) # ← removed
NOW=$(date +%c)
echo "[$NOW] > $JAR_PATH 실행" >> $START_LOG
nohup java -Xms256m -Xmx512m -XX:+UseG1GC \
-jar "$JAR_PATH" --spring.profiles.active=admin \
>> "$APP_LOG" 2>> "$ERROR_LOG" &
NEW_PID=$!
echo "[$NOW] > 서비스 PID: $NEW_PID" >> $START_LOG
🤖 Prompt for AI Agents
In scripts/start-admin.sh around lines 18 to 25, the script logs the service PID
before starting the Java process, so it does not capture the new PID of the
started service. Modify the script to capture the new PID immediately after
launching the Java process using $! and then log this new PID to the START_LOG
file to accurately reflect the running service's PID.

Comment on lines +55 to +72
cd deploy
zip -r ../${{ env.PROJECT_NAME }}-${{ env.DIVISION }}-${{ github.sha }}.zip .
cd ..
- name: AWS credential 설정
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
aws-access-key-id: ${{ secrets.DEVSERVER_CICD_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.DEVSERVER_CICD_SECRET_KEY }}

- name: S3에 업로드
run: aws deploy push \
--application-name "${{ env.AWS_CODE_DEPLOY_APPLICATION }}" \
--ignore-hidden-files \
--s3-location "s3://${{ env.AWS_S3_BUCKET }}/${{ env.PROJECT_NAME }}/${{ env.DIVISION }}/${{ github.sha }}.zip" \
--source "${{ env.PROJECT_NAME }}-${{ env.DIVISION }}-${{ github.sha }}.zip"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

ZIP 생성 후 aws deploy push 이중 압축 문제

이미 zip 명령으로 파일을 만들었는데 aws deploy push --source <zip파일> 은 디렉터리를 재압축합니다.
가장 간단한 해결책은 aws s3 cp 로 ZIP 을 업로드하고 create-deployment 시 해당 S3 객체를 지정하는 것입니다.

-    - name: S3에 업로드
-      run: aws deploy push \
-        --application-name "${{ env.AWS_CODE_DEPLOY_APPLICATION }}" \
-        --ignore-hidden-files \
-        --s3-location "s3://${{ env.AWS_S3_BUCKET }}/${{ env.PROJECT_NAME }}/${{ env.DIVISION }}/${{ github.sha }}.zip" \
-        --source "${{ env.PROJECT_NAME }}-${{ env.DIVISION }}-${{ github.sha }}.zip"
+    - name: S3에 업로드
+      run: aws s3 cp \
+        "${{ env.PROJECT_NAME }}-${{ env.DIVISION }}-${{ github.sha }}.zip" \
+        "s3://${{ env.AWS_S3_BUCKET }}/${{ env.PROJECT_NAME }}/${{ env.DIVISION }}/${{ github.sha }}.zip"
📝 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.

Suggested change
cd deploy
zip -r ../${{ env.PROJECT_NAME }}-${{ env.DIVISION }}-${{ github.sha }}.zip .
cd ..
- name: AWS credential 설정
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
aws-access-key-id: ${{ secrets.DEVSERVER_CICD_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.DEVSERVER_CICD_SECRET_KEY }}
- name: S3에 업로드
run: aws deploy push \
--application-name "${{ env.AWS_CODE_DEPLOY_APPLICATION }}" \
--ignore-hidden-files \
--s3-location "s3://${{ env.AWS_S3_BUCKET }}/${{ env.PROJECT_NAME }}/${{ env.DIVISION }}/${{ github.sha }}.zip" \
--source "${{ env.PROJECT_NAME }}-${{ env.DIVISION }}-${{ github.sha }}.zip"
cd deploy
zip -r ../${{ env.PROJECT_NAME }}-${{ env.DIVISION }}-${{ github.sha }}.zip .
cd ..
- name: AWS credential 설정
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
aws-access-key-id: ${{ secrets.DEVSERVER_CICD_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.DEVSERVER_CICD_SECRET_KEY }}
- name: S3에 업로드
run: aws s3 cp \
"${{ env.PROJECT_NAME }}-${{ env.DIVISION }}-${{ github.sha }}.zip" \
"s3://${{ env.AWS_S3_BUCKET }}/${{ env.PROJECT_NAME }}/${{ env.DIVISION }}/${{ github.sha }}.zip"
🧰 Tools
🪛 actionlint (1.7.7)

60-60: the runner of "aws-actions/configure-aws-credentials@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.37.1)

[error] 58-58: trailing spaces

(trailing-spaces)


[error] 65-65: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/deploy-admin.yml around lines 55 to 72, the current
workflow creates a ZIP file and then uses 'aws deploy push --source <zipfile>',
which causes double compression because 'aws deploy push' expects a directory,
not a ZIP file. To fix this, replace the 'aws deploy push' step with an 'aws s3
cp' command to upload the ZIP file directly to the S3 bucket, and then modify
the deployment step to use 'create-deployment' referencing the uploaded S3
object instead of pushing again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants