Skip to content

ci cd main 반영#41

Merged
Juhye0k merged 9 commits intomainfrom
dev
Dec 1, 2025
Merged

ci cd main 반영#41
Juhye0k merged 9 commits intomainfrom
dev

Conversation

@Juhye0k
Copy link
Copy Markdown
Contributor

@Juhye0k Juhye0k commented Dec 1, 2025

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 프로덕션 환경 배포 파이프라인 추가
    • 개발 및 프로덕션 환경 자동화 배포 워크플로우 구성
  • 인프라

    • 멀티 플랫폼 Docker 이미지 빌드 지원 (amd64, arm64)
    • 프로덕션 환경 설정 파일 추가
    • 환경별 독립적인 CI/CD 파이프라인 구축

✏️ Tip: You can customize this high-level summary in your review settings.

@Juhye0k Juhye0k requested a review from kon28289 December 1, 2025 02:29
@Juhye0k Juhye0k self-assigned this Dec 1, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

개발 및 프로덕션 환경을 위한 CI/CD 파이프라인 워크플로우를 신규 작성 및 재구성하였습니다. Dev 및 Prod 환경별 Build & Push, Deploy 단계를 분리하고, 프로덕션 환경을 위한 Spring Boot 설정 파일을 추가하였습니다.

Changes

Cohort / File(s) Change Summary
GitHub Actions 워크플로우 - 개발 환경
.github/workflows/dev-ci.yml, .github/workflows/dev-cd.yml
개발 환경 전용 CI/CD 파이프라인 신규 작성. dev 브랜치 푸시/PR 트리거 시 gradle 빌드 및 멀티플랫폼 Docker 이미지 빌드·푸시, 이후 개발 서버에 배포하는 워크플로우 구성
GitHub Actions 워크플로우 - 프로덕션 환경
.github/workflows/prod-ci.yml, .github/workflows/prod-cd.yml
프로덕션 환경 전용 CI/CD 파이프라인으로 재구성. main 브랜치 기반 트리거로 변경, 프로덕션 환경 설정 추가, 포트 및 환경변수(WEB_PORT, SPRING_PROFILES_ACTIVE=prod) 프로덕션 맞춤 수정
Spring Boot 설정 파일
src/main/resources/application-prod.yml, src/main/resources/application.yml
프로덕션 환경 전용 YAML 설정 파일 신규 작성(DB, Redis, 로깅 레벨 설정 포함). 기존 application.yml에 prod 프로필 추가하여 프로필 그룹 확장
보안 설정 서브모듈
src/main/resources/security
서브모듈 커밋 포인터 업데이트

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • 주의 사항:
    • GitHub Actions 워크플로우 전체 구조가 dev/prod 환경별로 명확히 분리되었는지 검증 필요
    • 프로덕션 배포 환경 설정(environment: production)이 GitHub 리포지토리 설정과 일치하는지 확인
    • 서브모듈 포인터 업데이트의 변경 내용 검증

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • kon28289

Poem

🐰 개발과 운영, 갈라 서면서
파이프라인 흐르고, 배포 솔솔~
환경마다 설정을 차려놓으니
프로덕션 서버 안정감 팡팡! 🚀
워크플로우 정리되니 참 보기 좋네

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning PR 설명이 완전히 누락되어 있으며, 리포지토리에서 요구하는 템플릿(개요, 주요 변경 사항, 스크린샷)의 어느 부분도 작성되지 않았습니다. 제공된 템플릿을 따라 PR 설명을 작성해주세요. 최소한 개요와 주요 변경사항 섹션은 필수입니다.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 본 변경사항을 간략히 설명하고 있으나, 한글 표현과 구체성 부분에서 개선의 여지가 있습니다. '반영'이라는 표현이 모호하며, 주요 변경사항인 CI/CD 워크플로우 정비와 프로덕션 환경 구성의 핵심을 명확히 전달하지 못합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@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: 2

♻️ Duplicate comments (1)
.github/workflows/prod-cd.yml (1)

5-15: Prod CI/CD 워크플로우 아키텍처 일관성 확인

이전에 prod-ci.yml에서 언급했듯이, Prod CI/CD 파이프라인이 Dev 파이프라인과 다른 구조를 가지고 있습니다:

  • Dev: CI에서 이미지 빌드/푸시 → CD에서 이미지 재사용
  • Prod: CI에서 JAR 빌드 → CD에서 이미지 빌드/푸시

이로 인해 Prod 배포 시마다 이미지를 새로 빌드하게 되며, 빌드 간 일관성 문제가 발생할 수 있습니다.

권장사항: 두 파이프라인을 통일하여 CI에서 이미지를 빌드/푸시하고, CD에서는 배포만 수행하도록 구조를 개선하세요.

🧹 Nitpick comments (2)
.github/workflows/prod-ci.yml (1)

1-7: Prod CI 워크플로우 구조가 Dev CI와 일관성이 없음

  • Dev CI (dev-ci.yml): 이미지를 빌드/푸시하고 이미지 태그를 출력 → dev-cd에서 이미지 재사용
  • Prod CI (prod-ci.yml): JAR 아티팩트만 빌드 → prod-cd에서 다시 Docker 이미지 빌드

이로 인해:

  1. Prod 파이프라인에서 빌드가 중복됨 (CI에서 Gradle, CD에서 Docker)
  2. 같은 코드 버전에서 여러 번 빌드되어 빌드 간 일관성 문제 가능성
  3. 배포 시 추가 시간 소모

권장사항: Prod CI에서도 Docker 이미지를 빌드/푸시하고 이미지 태그를 출력하여 Dev CI와 동일한 패턴으로 통일하세요.

이 구조가 의도된 설계인지, 아니면 Dev CI와 동일하게 이미지를 빌드해서 배포해야 하는지 확인하세요.

src/main/resources/application-prod.yml (1)

27-28: 운영 환경 로깅 설정 재검토

운영 환경에서 다음 설정이 성능에 영향을 줄 수 있습니다:

  • Line 27: mvc.log-request-details: true - 모든 HTTP 요청의 상세 정보가 로깅됨 (요청/응답 본문 포함)
  • Line 34: show-sql: true - 모든 SQL 쿼리가 로깅됨

이 설정들은 개발/디버깅 환경에서는 유용하지만, 운영 환경에서는:

  1. 로그 볼륨 급증 (스토리지/비용 증가)
  2. I/O 오버헤드 (성능 저하 가능)
  3. 민감한 데이터 노출 가능성 (쿼리 파라미터, 사용자 정보 등)

권장사항: 운영 환경에서는 false로 설정하고, 필요시 특정 조건에서만 활성화하거나, 별도의 디버그 환경을 구성하세요.

  mvc:
    log-request-details: false  # 운영 환경에서는 비활성화
  
  jpa:
    show-sql: false  # 운영 환경에서는 비활성화

Also applies to: 34-34

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3dd8e9 and ba331fd.

📒 Files selected for processing (7)
  • .github/workflows/dev-cd.yml (1 hunks)
  • .github/workflows/dev-ci.yml (1 hunks)
  • .github/workflows/prod-cd.yml (2 hunks)
  • .github/workflows/prod-ci.yml (2 hunks)
  • src/main/resources/application-prod.yml (1 hunks)
  • src/main/resources/application.yml (1 hunks)
  • src/main/resources/security (1 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
🔇 Additional comments (6)
.github/workflows/dev-ci.yml (2)

30-31: Output 정의에서 여러 태그 처리 명확히 하기

Line 31의 outputs.image-tag${{ steps.meta.outputs.tags }}를 직접 사용하고 있습니다. 이 값이 dev-cd.yml에서 예상하는 단일 태그 형식과 일치하는지 확인하세요. 필요시 첫 번째 태그만 추출하도록 처리하는 것이 좋습니다.


74-102: The current implementation is consistent and correct. docker/metadata-action@v5 with only type=sha configured produces a single-line output (format: sha-<commit-hash>), which is properly captured by head -n 1 in dev-cd.yml line 33. There is no format mismatch between the tag extraction and usage.

If additional tag types (e.g., type=ref, type=semver) are added to the metadata action in the future, the output would become multi-line and require updated parsing logic, but this is not a current concern.

Likely an incorrect or invalid review comment.

src/main/resources/application.yml (1)

8-8: Spring 프로필 그룹에 prod 추가 - LGTM

운영 환경용 prod 프로필이 적절히 추가되었습니다. application-prod.yml 파일과 함께 SPRING_PROFILES_ACTIVE=prod로 활성화될 때 올바르게 작동합니다.

.github/workflows/dev-cd.yml (2)

24-33: 이미지 태그 파일 읽기 형식 검증

Line 31-33에서 image_tag.txt에서 첫 번째 라인을 읽어 IMAGE_TAG 환경변수로 설정하고 있습니다. 이는 dev-ci.yml Line 96에서 저장한 형식과 일치해야 합니다.

docker/metadata-action이 여러 태그를 출력하는 경우, head -n 1만 사용하면 의도하지 않은 태그를 선택할 수 있습니다. 태그 형식을 명시적으로 검증하세요.

dev-ci.yml의 이미지 태그 내보내기 형식과 여기서 읽는 형식이 정확히 일치하는지 확인하세요.


15-20: GitHub Environment 설정 검증 필수

Line 19-20에서 development 환경을 참조하고 있습니다. 이 환경이 GitHub에 정의되어 있고 CONTAINER_NAME, NETWORK_NAME 등의 변수들이 설정되어 있는지 확인하세요. 또한 self-hosted 러너에 필요한 권한이 설정되어 있어야 합니다.

.github/workflows/prod-cd.yml (1)

62-94: Prod CD 배포 작업 - 환경 설정 검증 필수

Line 67-68에서 production GitHub Environment를 사용하고 있습니다. Line 89, 90, 91에서 vars.CONTAINER_NAME, vars.NETWORK_NAME, secrets.WEB_PORT 등의 변수들을 참조하고 있습니다.

다음을 확인하세요:

  1. production 환경이 GitHub에 정의되어 있는가
  2. 필요한 모든 변수와 시크릿이 설정되어 있는가
  3. Self-hosted 러너가 이 환경에 접근할 수 있는 권한이 있는가

Comment on lines +6 to +11
- security/application-database.yml
- security/application-security.yml
- security/application-mail.yml
- security/application-swagger.yml
- security/application-wifi.yml
- security/application-cloudinary.yml
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Dec 1, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if security configuration files exist
find src/main/resources/security -name "application-*.yml" 2>/dev/null | sort

Repository: Geumpumta/backend

Length of output: 43


🏁 Script executed:

#!/bin/bash
# Check if security directory exists and list its contents
ls -la src/main/resources/security/ 2>&1

# Also check what's in the main resources directory
echo "=== Contents of src/main/resources ==="
ls -la src/main/resources/ 2>&1

# Search for any of these files repository-wide
echo "=== Searching for application-*.yml files ==="
find . -name "application-*.yml" 2>/dev/null | head -20

Repository: Geumpumta/backend

Length of output: 867


🏁 Script executed:

cat -n src/main/resources/application-prod.yml

Repository: Geumpumta/backend

Length of output: 1857


Missing security configuration files prevent production deployment

Lines 6-11 import six security configuration files from the security/ directory, but this directory is empty. The following required files do not exist:

  • security/application-database.yml
  • security/application-security.yml
  • security/application-mail.yml
  • security/application-swagger.yml
  • security/application-wifi.yml
  • security/application-cloudinary.yml

Spring will fail to load the prod profile without these files. Create these files in src/main/resources/security/ with the necessary configuration for each component (database, security, mail, Swagger, WiFi, and Cloudinary settings).

🤖 Prompt for AI Agents
In src/main/resources/application-prod.yml around lines 6 to 11, the prod
profile imports six security config files that are missing; create the following
files under src/main/resources/security/: application-database.yml,
application-security.yml, application-mail.yml, application-swagger.yml,
application-wifi.yml, and application-cloudinary.yml. For each file add the
required Spring properties for that component (database: datasource
URL/username/password/driver and JPA settings; security: auth provider, JWT/CSRF
settings, roles and endpoints; mail: host/port/username/password/protocol and
from address; swagger: enablement flags and API metadata; wifi: any
environment-specific SSID/credentials or toggles used by the app; cloudinary:
cloud name/api key/api secret and secure flag). Ensure property names match the
application code (confirm prefix names used in @ConfigurationProperties or
Environment lookups) and validate by running the app under the prod profile so
Spring can load all imported files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

아래 대화내역 참고해줘

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the .gitmodules file to confirm submodule configuration
echo "=== Checking .gitmodules ==="
cat .gitmodules 2>/dev/null || echo "No .gitmodules file found"

echo -e "\n=== Checking submodule status ==="
git submodule status 2>/dev/null || echo "No submodules or git not available"

echo -e "\n=== Checking src/main/resources/security ==="
ls -la src/main/resources/security/ 2>&1

echo -e "\n=== Fetching PR comments to find additional context ==="
gh pr view 41 --json comments --jq '.comments[] | "[\(.author.login)] \(.body)"' 2>&1 | head -50

Length of output: 2260


🏁 Script executed:

#!/bin/bash
# Fetch all review comments on PR 41 to find the conversation thread
echo "=== Fetching review comments from PR 41 ==="
gh pr view 41 --json reviews --jq '.reviews[] | {author: .author.login, state: .state, body: .body, comments: [.comments[]? | {path: .path, body: .body}]}' 2>&1

echo -e "\n=== Fetching review threads specifically ==="
gh api repos/Geumpumta/backend/pulls/41/comments --jq '.[] | select(.path == "src/main/resources/application-prod.yml") | {user: .user.login, body: .body, created_at: .created_at}' 2>&1 | head -100

Length of output: 9671


@Juhye0k 죄송합니다! 제가 이전 분석에서 실수했습니다.

말씀하신 대로 src/main/resources/security비공개 Git 서브모듈로 설정되어 있어서, 실제로는 해당 보안 설정 파일들이 https://github.com/Geumpumta/backend-security.git 저장소에 존재합니다.

제 샌드박스 환경에서는 이 비공개 서브모듈에 접근할 수 없어서 디렉토리가 비어있는 것처럼 보였고, 그래서 파일이 없다고 잘못 판단했습니다.

현재 구성은 올바릅니다:

  • ✅ 보안 설정 파일들은 별도의 비공개 저장소에서 관리
  • ✅ 서브모듈 커밋이 업데이트됨 (fd01d78 → 24fc3c9)
  • application-prod.yml에서 security 디렉토리의 설정 파일들을 정상적으로 import

이전 코멘트는 무시하셔도 됩니다. 프로덕션 배포에 문제가 없을 것입니다! 🎉


🧠 Learnings used
Learnt from: Juhye0k
Repo: Geumpumta/backend PR: 41
File: src/main/resources/security:1-1
Timestamp: 2025-12-01T03:06:04.769Z
Learning: The `backend-security` repository at https://github.com/Geumpumta/backend-security.git is a private repository used as a submodule at src/main/resources/security, so automated verification of submodule commits may fail due to access restrictions.

Copy link
Copy Markdown
Contributor

@kon28289 kon28289 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

@Juhye0k Juhye0k merged commit d310553 into main Dec 1, 2025
4 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 1, 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.

2 participants