Skip to content

Conversation

@bbbang105
Copy link
Member

@bbbang105 bbbang105 commented Jun 8, 2025

✅ PR 유형

어떤 변경 사항이 있었나요?

  • 새로운 기능 추가
  • 버그 수정
  • 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경)
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 문서 수정
  • 빌드 부분 혹은 패키지 매니저 수정
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제

🚀 작업 내용

이번 PR에서 작업한 내용을 구체적으로 설명해주세요. (이미지 첨부 가능)

  • GitHub Actions 기반 CICD를 구축한다

📝️ 관련 이슈

본인이 작업한 내용이 어떤 Issue와 관련이 있는지 작성해주세요.


💬 기타 사항 or 추가 코멘트

남기고 싶은 말, 참고 블로그 등이 있다면 기록해주세요.

Summary by CodeRabbit

  • Chores
    • "Crawler CI/CD" 자동화 워크플로우가 추가되어, develop 브랜치로의 풀 리퀘스트 시 빌드, Docker 이미지 배포, 그리고 원격 서버에 자동 배포가 이루어집니다.

@bbbang105 bbbang105 self-assigned this Jun 8, 2025
@bbbang105 bbbang105 added the 🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 label Jun 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 8, 2025

"""

Walkthrough

새로운 GitHub Actions 워크플로우 파일이 추가되어, develop 브랜치로의 풀 리퀘스트 발생 시 크롤러 애플리케이션의 빌드, DockerHub 이미지 푸시, AWS EC2 서버 배포까지 자동화하는 CI/CD 파이프라인이 구성되었습니다.

Changes

파일/경로 변경 요약
.github/workflows/crawler-cicd.yaml develop 브랜치 PR 트리거, 빌드/푸시/배포 자동화 워크플로우 신규 추가

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub Actions
    participant DockerHub
    participant AWS EC2

    Developer->>GitHub Actions: PR to develop 브랜치 생성
    GitHub Actions->>GitHub Actions: 코드 체크아웃 & Python 세팅
    GitHub Actions->>DockerHub: Docker 로그인, 이미지 빌드 및 latest 태그로 푸시
    GitHub Actions->>AWS EC2: SSH 접속 후 deploy.sh 실행
Loading

Possibly related issues

Poem

🐰
깡총깡총 토끼가 코드를 배달해,
PR이 오면 자동으로 빌드가 돼.
Docker에 실어 구름 위로 띄우고,
EC2로 점프해 배포까지 해내네!
오늘도 CI/CD로 신나게 뛰는 토끼의 하루.

"""


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

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

🧹 Nitpick comments (2)
.github/workflows/crawler-cicd.yaml (2)

15-19: 🐍 Python 설정 스텝 불필요 여부 검토
현재 워크플로우에서 Python 관련 명령(python 실행이나 테스트)이 없어 보입니다. 실제 필요 없다면 해당 스텝을 제거하거나, 테스트/패키징 스텝을 추가하는 방안을 고려하세요.

🧰 Tools
🪛 actionlint (1.7.7)

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

(action)


26-30: 이미지 태깅 정책 개선 제안
latest 태그 외에 Git SHA나 빌드 번호를 포함해 이력이 관리되도록 하면 롤백 및 추적이 용이해집니다. 또한 DOCKER_IMAGE_NAME은 시크릿 대신 환경 변수로 관리하는 걸 권장합니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ce052e7 and aa9e70f.

📒 Files selected for processing (1)
  • .github/workflows/crawler-cicd.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/crawler-cicd.yaml

13-13: 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)


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

(action)


21-21: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-and-deploy
🔇 Additional comments (5)
.github/workflows/crawler-cicd.yaml (5)

1-2: name 필드 명확함
워크플로우 이름이 변경 내역을 간결하게 설명합니다.


3-6: pull_request 이벤트 시 시크릿 노출 검증 필요
pull_request로 트리거하면 포크된 PR의 경우 시크릿이 비노출되어 이후 로그인 또는 배포 단계가 실패할 수 있습니다. 외부 기여자 작업 흐름을 고려해 pull_request_target 사용 또는 문서화가 필요합니다.


7-10: 런너 설정 적절
ubuntu-latest 환경 사용은 표준적이며 문제 없습니다.


12-14: 코드 체크아웃 스텝 올바름
actions/checkout@v3 사용은 최신 버전이며 권장됩니다.

🧰 Tools
🪛 actionlint (1.7.7)

13-13: 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)


20-25: DockerHub 로그인 스텝 적절
docker/login-action@v2로 시크릿 기반 로그인을 처리하는 방식은 안전합니다.

🧰 Tools
🪛 actionlint (1.7.7)

21-21: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines 31 to 39
- name: 🚀 AWS EC2에 배포 스크립트 실행
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.AWS_EC2_SSH_KEY }}
script: |
chmod +x ./deploy.sh
./deploy.sh
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

SSH 액션 버전 고정 및 보안 강화
appleboy/ssh-action@master는 예측 불가능한 업데이트 위험이 있으므로 릴리스 태그나 커밋 SHA로 버전을 고정하세요. 또한 known_hosts 설정을 추가해 MITM 공격을 방지하는 절차를 고려해야 합니다. 배포 스크립트(deploy.sh) 경로가 작업 디렉토리 기준으로 유효한지도 확인해 주세요.


deploy.sh 파일 존재 여부와 워크플로우에서 known_hosts 사용 여부를 확인하기 위한 스크립트를 실행합니다.


🏁 Script executed:

#!/usr/bin/env bash
# deploy.sh 파일 위치 검색
echo "Searching for deploy.sh:"
fd deploy.sh || echo "deploy.sh not found"

# 워크플로우에서 known_hosts 설정 사용 여부 검색
echo "Checking for known_hosts in .github/workflows:"
rg "known_hosts" -g ".github/workflows/*.yaml" || echo "No known_hosts usage found"

Length of output: 435


SSH 액션 버전 고정 및 호스트 지문 검증 추가 필요

워크플로우에 아래 사항을 반영해주세요:

  • .github/workflows/crawler-cicd.yaml (31–39줄)

    • uses: appleboy/ssh-action@master → 릴리스 태그(예: @v0.6.0) 또는 커밋 SHA로 버전 고정
    • with: 블록에 known_hosts: ${{ secrets.AWS_EC2_KNOWN_HOSTS }} 입력 추가 (MITM 방지용 호스트 지문 검증)
  • deploy.sh 스크립트 경로 검증
    워크플로우가 실행되는 디렉터리 기준으로 deploy.sh가 존재하는지, 상대 경로가 올바른지 확인하세요.

예시 변경안:

 uses: appleboy/ssh-action@master
-with:
+with:
   host: ${{ secrets.AWS_EC2_HOST }}
   username: ${{ secrets.AWS_EC2_USERNAME }}
   key: ${{ secrets.AWS_EC2_SSH_KEY }}
+  known_hosts: ${{ secrets.AWS_EC2_KNOWN_HOSTS }}
   script: |
     chmod +x ./deploy.sh
     ./deploy.sh
📝 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: 🚀 AWS EC2에 배포 스크립트 실행
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.AWS_EC2_SSH_KEY }}
script: |
chmod +x ./deploy.sh
./deploy.sh
- name: 🚀 AWS EC2에 배포 스크립트 실행
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.AWS_EC2_SSH_KEY }}
known_hosts: ${{ secrets.AWS_EC2_KNOWN_HOSTS }}
script: |
chmod +x ./deploy.sh
./deploy.sh
🤖 Prompt for AI Agents
In .github/workflows/crawler-cicd.yaml around lines 31 to 39, change the SSH
action version from the floating 'master' tag to a fixed release tag or commit
SHA like '@v0.6.0' to avoid unpredictable updates. Add a 'known_hosts' input
with the value '${{ secrets.AWS_EC2_KNOWN_HOSTS }}' to enable host key
verification and prevent MITM attacks. Also, verify that the 'deploy.sh' script
path is correct relative to the workflow's working directory to ensure it exists
and is executable during the deployment step.

@bbbang105 bbbang105 added the 🚨 fix 버그 수정 / 에러 해결 label Jun 8, 2025
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: 1

♻️ Duplicate comments (1)
.github/workflows/crawler-cicd.yaml (1)

32-36: SSH 액션 버전 고정 및 호스트 검증 추가
appleboy/ssh-action@master은 예측 불가능한 업데이트 위험이 있으므로 릴리스 태그나 커밋 SHA로 버전을 고정하고, 호스트 키 검증을 위해 known_hosts: ${{ secrets.AWS_EC2_KNOWN_HOSTS }} 입력을 추가해야 합니다.

🧹 Nitpick comments (1)
.github/workflows/crawler-cicd.yaml (1)

40-40: 파일 끝에 개행 추가
YAML 파일 끝에 새 줄이 누락되어 있습니다. 끝에 개행을 추가해 주세요.

🧰 Tools
🪛 YAMLlint (1.37.1)

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

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between aa9e70f and 580da89.

📒 Files selected for processing (1)
  • .github/workflows/crawler-cicd.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/crawler-cicd.yaml

13-13: 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)


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

(action)


21-21: the runner of "docker/login-action@v2" 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/crawler-cicd.yaml

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

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

🔇 Additional comments (5)
.github/workflows/crawler-cicd.yaml (5)

3-5: 풀 리퀘스트 이벤트 트리거 적절
워크플로우가 pull_request 이벤트로만 실행되도록 설정되었습니다. PR 기준 빌드 테스트 및 배포 검증에 적합합니다.


12-13: 코드 체크아웃 액션 버전 적절
actions/checkout@v3 사용으로 최신 안정 버전을 활용하고 있습니다.

🧰 Tools
🪛 actionlint (1.7.7)

13-13: 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)


16-18: Python 설정 액션 적절
actions/setup-python@v4python-version: '3.12' 설정이 명확합니다.

🧰 Tools
🪛 actionlint (1.7.7)

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

(action)


21-24: DockerHub 로그인 액션 적절
docker/login-action@v2와 시크릿 활용이 안전한 패턴입니다.

🧰 Tools
🪛 actionlint (1.7.7)

21-21: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


27-29: Docker 이미지 빌드 및 푸시 주기 검토 필요
PR 이벤트마다 DockerHub로 이미지를 푸시하고 있습니다. 의도된 동작인지, PR마다 레지스트리가 불필요하게 증가하지는 않는지 확인하세요.

Comment on lines +37 to +40
script: |
cd ~/
sudo chmod +x deploy.sh
sudo ./deploy.sh 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.

⚠️ Potential issue

원격 서버에 deploy.sh 존재 여부 확인 필요
SSH로 접속 후 deploy.sh를 실행하지만, 원격 서버에 해당 스크립트가 존재하지 않거나 올바른 경로에 없을 수 있습니다. 배포 전에 스크립트 복사(scp) 또는 원격 저장소 클론(git clone) 등을 선행해야 합니다.

🧰 Tools
🪛 YAMLlint (1.37.1)

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

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

🤖 Prompt for AI Agents
In .github/workflows/crawler-cicd.yaml around lines 37 to 40, the deploy.sh
script is executed on the remote server without verifying its existence or
ensuring it is present. Before running deploy.sh, add steps to copy the script
to the remote server using scp or clone the repository containing the script via
git clone, so the script is guaranteed to be available at the expected location.

@bbbang105 bbbang105 merged commit f07de80 into develop Jun 8, 2025
2 of 3 checks passed
@bbbang105 bbbang105 deleted the feature/#11/cicd branch June 8, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 🚨 fix 버그 수정 / 에러 해결

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] : CICD 파이프라인을 구축한다

2 participants