Skip to content

Bug/#38#41

Merged
fixgramwork merged 3 commits intodevelopfrom
bug/#38
Jul 24, 2025
Merged

Bug/#38#41
fixgramwork merged 3 commits intodevelopfrom
bug/#38

Conversation

@fixgramwork
Copy link
Member

@fixgramwork fixgramwork commented Jul 24, 2025

Summary by CodeRabbit

  • Chores
    • 새로운 GitHub Actions 배포 워크플로우가 추가되고, 기존 Spring CD 워크플로우가 삭제되었습니다.
    • Spring CI 워크플로우에서 사용되는 액션 버전이 최신으로 업데이트되고, 코드 커버리지 업로드 단계가 제거되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Jul 24, 2025

Walkthrough

기존에 사용하던 Spring 프로젝트의 GitHub Actions 배포 워크플로우(spring-cd.yml)가 삭제되고, 새로운 워크플로우(Spring-develop-CD.yml)가 추가되었습니다. 또한 CI 워크플로우(spring-ci.yaml)는 사용 중인 액션의 버전이 최신으로 업데이트되고, 코드 커버리지 업로드 단계가 삭제되었습니다.

Changes

파일/경로 변경 요약
.github/workflows/Spring-develop-CD.yml PR close 시 EC2로 Spring 애플리케이션 배포를 수행하는 신규 GitHub Actions 워크플로우 추가
.github/workflows/spring-cd.yml 기존 Spring 배포용 GitHub Actions 워크플로우 파일 삭제
.github/workflows/spring-ci.yaml 액션 버전 업그레이드, gradlew 권한 설정 위치 변경, codecov 단계 삭제 등 CI 워크플로우 개선

Sequence Diagram(s)

sequenceDiagram
    participant GitHub
    participant EC2

    GitHub->>GitHub: PR closed (develop 브랜치 대상)
    GitHub->>GitHub: build job 실행 (JDK, Gradle, properties 설정, 빌드, JAR 생성)
    GitHub->>EC2: SCP로 JAR 파일 전송
    GitHub->>EC2: deploy job 실행 (SSH 접속)
    EC2->>EC2: 기존 8080 포트 프로세스 종료
    EC2->>EC2: JAR 백그라운드 실행 및 로그 기록
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Revert "Bug/ #21" #31: 기존 spring-cd.yml 워크플로우를 삭제하고 PR close 시 배포하는 새로운 워크플로우를 도입하는 등, 동일한 배포 파이프라인 파일과 관련된 변경을 다룹니다.
  • Feat/#33 #35: 기존 spring-cd.yml 워크플로우의 트리거와 이름만 변경하는 PR로, 배포 워크플로우 파일의 변경이라는 점에서 관련성이 있습니다.

Poem

🐇
새로운 워크플로우가 춤을 추네,
EC2로 점프하는 봄처럼 가볍게.
오래된 길은 잠시 쉬고,
최신 액션들이 반짝이며 빌드하지!
토끼는 기뻐하며 귀를 쫑긋,
코드의 봄날을 노래하네.
🌱✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/#38

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 generate unit tests to generate unit tests for 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.

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: 3

🧹 Nitpick comments (5)
.github/workflows/spring-ci.yaml (2)

34-38: 코드 커버리지 업로드 단계가 제거되었습니다
codecov/codecov-action 단계가 사라져 커버리지 변동을 추적할 수 없습니다. 의도적 삭제라면 무시해도 되지만, 커버리지를 계속 확인해야 한다면 재도입을 권장합니다. 필요하시면 설정 예시를 제공해 드리겠습니다.


38-38: 파일 끝에 개행(Newline)이 없습니다
일부 린터와 git diff 설정에서 경고가 발생할 수 있습니다. EOF 개행을 추가해 주세요.

.github/workflows/Spring-develop-CD.yml (3)

1-2: 워크플로 이름 오타 – ‘Deplot’ → ‘Deploy’

-name: Spring Deplot to EC2
+name: Spring Deploy to EC2

37-38: JAR 파일 패턴이 모호해 실패할 수 있습니다
*SNAPSHOT.jar가 둘 이상이거나 스냅샷이 아닌 빌드라면 mv가 실패합니다.

-        run: mv ./build/libs/*SNAPSHOT.jar ./cd.jar
+        run: |
+          JAR=$(ls build/libs/*SNAPSHOT.jar | head -n 1)
+          mv "$JAR" cd.jar

66-66: EOF 개행이 없습니다
YAMLLint 경고를 피하려면 파일 끝에 빈 줄을 추가하세요.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between eb71c3e and 8af9788.

📒 Files selected for processing (3)
  • .github/workflows/Spring-develop-CD.yml (1 hunks)
  • .github/workflows/spring-cd.yml (0 hunks)
  • .github/workflows/spring-ci.yaml (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/spring-cd.yml
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/spring-ci.yaml

[error] 38-38: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/Spring-develop-CD.yml

[error] 66-66: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (2)
.github/workflows/spring-ci.yaml (2)

5-6: 브랜치 필터가 모든 브랜치를 포함합니다 – 의도한 설정인지 확인해주세요
branches: ["*"] 설정은 태그 푸시까지 포함해 모든 브랜치(와 참조)에 대해 워크플로가 실행됩니다. 필요 이상으로 CI 트래픽이 증가할 수 있습니다. ["main", "develop"] 처럼 구체적으로 지정하거나 branches-ignore를 병행하는 방안을 검토해 주세요.


15-20: java-version은 문자열로 명시하는 것이 안전합니다
공식 문서 예시는

java-version: '17'

처럼 따옴표로 감싼 문자열을 사용합니다. 정수 리터럴로 둘 경우 내부 파싱이나 캐싱 키 계산 시 예기치 않은 문제가 생길 여지가 있습니다.

-          java-version: 17
+          java-version: '17'

Comment on lines +3 to +7
on:
pull_request:
types: [closed]
branches: ["develop"]

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

PR closed 이벤트만으로는 머지 여부를 보장하지 못합니다
닫힌(PR closed) 후에도 ‘머지되지 않은 닫힘’이 포함됩니다. 머지된 경우에만 배포하려면 각 job 또는 step에 조건을 추가하세요.

if: github.event.pull_request.merged == true
🤖 Prompt for AI Agents
In .github/workflows/Spring-develop-CD.yml around lines 3 to 7, the workflow
triggers on pull_request closed events but does not ensure the PR was merged. To
fix this, add a condition to each job or step using 'if:
github.event.pull_request.merged == true' so that deployment only occurs when
the PR is merged, not just closed.

Comment on lines +24 to +30
- name: application.properties 파일 설정
run: |
mkdir -p src/main/resources
mkdir -p src/test/resources
echo "${{ secrets.APPLICATION_PROPERTIES }}" > ./src/main/resources/application.properties
echo "${{ secrets.TEST_APPLICATION_PROPERTIES }}" > ./src/test/resources/application.properties

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

echo로 secrets를 쓰면 줄바꿈·특수문자가 손실됩니다
멀티라인 secret(예: \n 포함) 은 cat <<'EOF' 구문으로 안전하게 기록하세요.

-          echo "${{ secrets.APPLICATION_PROPERTIES }}" > ./src/main/resources/application.properties
-          echo "${{ secrets.TEST_APPLICATION_PROPERTIES }}" > ./src/test/resources/application.properties
+          cat <<'EOF' > ./src/main/resources/application.properties
+${{ secrets.APPLICATION_PROPERTIES }}
+EOF
+          cat <<'EOF' > ./src/test/resources/application.properties
+${{ secrets.TEST_APPLICATION_PROPERTIES }}
+EOF
📝 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
- name: application.properties 파일 설정
run: |
mkdir -p src/main/resources
mkdir -p src/test/resources
echo "${{ secrets.APPLICATION_PROPERTIES }}" > ./src/main/resources/application.properties
echo "${{ secrets.TEST_APPLICATION_PROPERTIES }}" > ./src/test/resources/application.properties
- name: application.properties 파일 설정
run: |
mkdir -p src/main/resources
mkdir -p src/test/resources
cat <<'EOF' > ./src/main/resources/application.properties
${{ secrets.APPLICATION_PROPERTIES }}
EOF
cat <<'EOF' > ./src/test/resources/application.properties
${{ secrets.TEST_APPLICATION_PROPERTIES }}
EOF
🤖 Prompt for AI Agents
In .github/workflows/Spring-develop-CD.yml around lines 24 to 30, the use of
echo to write secrets to application.properties causes loss of newlines and
special characters. Replace the echo commands with a here-document syntax using
cat <<'EOF' to safely write the multiline secrets preserving formatting. This
ensures the secrets are correctly written with all special characters intact.

Comment on lines +56 to +66
- name: SSH로 EC2에 접속하기
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script_stop: true
script: |
cd clue
sudo fuser -k -n tcp 8080 || true
sudo nohup java -jar cd.jar > ./output.log 2>&1 & No newline at end of file
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

백그라운드 실행/포트 종료 로직이 취약합니다

  • sudo nohup는 working dir가 /root로 바뀌어 cd.jar를 찾지 못할 위험이 있습니다.
  • 프로세스 관리를 systemd 혹은 pm2 등으로 이관하면 재부팅·재시작 시 안정적입니다.
    최소한 다음과 같이 경로를 절대경로로 지정하세요.
-            sudo nohup java -jar cd.jar > ./output.log 2>&1 &
+            sudo nohup java -jar /home/ubuntu/clue/cd.jar > /home/ubuntu/clue/output.log 2>&1 &
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 66-66: no new line character at the end of file

(new-line-at-end-of-file)

🤖 Prompt for AI Agents
In .github/workflows/Spring-develop-CD.yml around lines 56 to 66, the SSH action
runs the Java jar with sudo nohup which changes the working directory to /root,
causing potential failure to find cd.jar. To fix this, replace relative paths
with absolute paths for cd.jar and output.log in the script. Additionally,
consider migrating process management to systemd or pm2 for better stability on
reboot or restart.

@fixgramwork fixgramwork merged commit c62b6ef into develop Jul 24, 2025
1 check passed
@fixgramwork fixgramwork deleted the bug/#38 branch July 24, 2025 23:42
@coderabbitai coderabbitai bot mentioned this pull request Sep 18, 2025
@coderabbitai coderabbitai bot mentioned this pull request Sep 25, 2025
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.

1 participant