Skip to content

Conversation

@kaswhy
Copy link
Member

@kaswhy kaswhy commented Aug 24, 2025

📌 연관된 이슈

✨ 작업 내용

  • 프로젝트 구조를 단일 모듈에 맞게 루트 승격
  • dockerignore 추가
  • 프로젝트 구조 변경에 따른 CI/CD 변경

💬 리뷰 요구사항(선택)

Summary by CodeRabbit

  • 신기능

    • 없음
  • 개선/Chores

    • Docker 빌드/런타임 이미지 및 설정 변경으로 빌드·이미지 크기 최적화
    • .dockerignore·.gitignore 추가/정리로 빌드 컨텍스트 정리 및 보안·속도 향상
    • CI·배포 워크플로 조정: 앱스펙 준비, 패키지명 통일(deploy-dev/prod), 환경파일 작성 방식 개선, AWS 자격증명 액션 적용
    • 프로젝트 설정 파일명 및 포맷 정비로 일관성 개선
  • 테스트

    • 신규 단위 테스트 스켈레톤 추가 (추후 구현 필요)

kaswhy and others added 9 commits May 11, 2025 17:02
[FIX] 스터디 신청 시 파일 관련 예외 처리 추가 및 구글 로그인 인가 오류 수정
[FIX] 토큰 불일치 로그 추가
[FIX] 토큰 재발급 시 로그 추가
[FIX] 토큰 재발급 시 로그인 타입을 enum으로 저장
[FIX] 구글 로그인 시 쿠키 도메인을 프론트 도메인으로 설정
[FIX] 스터디 상세 조회 시 imagePath 주는 오류 수정
[FEAT] CI 추가 및 RDS 변경
@kaswhy kaswhy self-assigned this Aug 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 24, 2025

Walkthrough

프로젝트를 단일 모듈 루트로 재구성하고 빌드/배포 파이프라인과 Docker 빌드를 루트 기준으로 정리했다. CI/CD 워크플로우는 appspec 준비 방식, 패키징 이름, AWS 자격 설정 및 Docker 이미지 태깅을 갱신했고, 무시 파일과 Gradle 설정이 정리됐다.

Changes

Cohort / File(s) Summary
CI 파이프라인 정리
.github/workflows/ci.yml
워킹 디렉터리(gdgoc) 제거로 루트에서 실행되도록 조정, Java/환경 블록 재포맷, 로그 경로를 루트 기준으로 변경.
Dev 배포 파이프라인 개편
.github/workflows/deploy-dev.yml
appspec.dev.ymlappspec.yml로 복사하도록 변경, .env 생성 방식을 heredoc으로 변경, 패키지명 deploy-dev.zip으로 변경, aws-actions/configure-aws-credentials@v4 도입, S3 업로드 및 CodeDeploy 인자/번들명 정합화.
Prod 배포 파이프라인 개편
.github/workflows/deploy-prod.yml
Docker 이미지에 latest와 SHA 태그 추가 및 푸시, appspec.prod.ymlappspec.yml 복사, .env heredoc 생성, 패키지명 deploy-prod.zip, AWS 자격 액션 도입 및 CodeDeploy 인자 인용.
Docker 빌드 구조 전환
Dockerfile
루트에서 Gradle 8.11.1로 빌드(./gradlew bootJar), 산출물 경로를 /app/build/libs로 조정, 런타임을 eclipse-temurin:17-jre로 전환, EXPOSE 8080 및 절대 경로 ENTRYPOINT 적용.
Gradle 프로젝트 루트화
settings.gradle, gdgoc/settings.gradle
루트 settings.gradlerootProject.name = '24-2_GDGoC_Server' 추가, gdgoc/settings.gradle의 동일 설정 제거(루트화 반영).
Ignore/도커 컨텍스트 정리
.dockerignore, .gitignore
.dockerignore 신설로 빌드 아티팩트·환경 파일 제외 규칙 추가, .gitignore의 일부 경로/패턴(환경 파일/빌드 경로) 조정.
로컬 설정 포맷 정리
src/main/resources/application-local.yml
주석 제거 등 포맷 변경만 수행(설정 값은 변경 없음).
테스트 추가(스켈레톤)
src/test/java/inha/gdgoc/domain/recruit/service/RecruitMemberServiceTest.java
새 테스트 클래스 및 메서드 추가(현재 서비스 호출/검증 미구현, 골격만 존재).

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev as 개발자
    participant GH as GitHub Actions (deploy-dev)
    participant AWS as AWS Credentials Action
    participant S3 as Amazon S3
    participant CD as CodeDeploy

    Dev->>GH: Push to dev branch
    GH->>GH: Prepare appspec.yml (cp appspec.dev.yml)
    GH->>GH: Create .env (heredoc)
    GH->>GH: zip -> deploy-dev.zip
    GH->>AWS: configure-aws-credentials@v4
    AWS-->>GH: Temporary credentials
    GH->>S3: Upload deploy-dev.zip
    GH->>CD: CreateDeployment (bundle: deploy-dev.zip)
    CD-->>GH: Deployment started
Loading
sequenceDiagram
    autonumber
    participant Dev as 개발자
    participant GH as GitHub Actions (deploy-prod)
    participant Docker as Docker Registry
    participant AWS as AWS Credentials Action
    participant S3 as Amazon S3
    participant CD as CodeDeploy

    Dev->>GH: Push to main/release
    GH->>GH: Build docker image (-t repo:latest, -t repo:SHA)
    GH->>Docker: Push latest and SHA tags
    GH->>GH: Prepare appspec.yml (cp appspec.prod.yml)
    GH->>GH: Create .env (heredoc) and zip -> deploy-prod.zip
    GH->>AWS: configure-aws-credentials@v4
    AWS-->>GH: Temporary credentials
    GH->>S3: Upload deploy-prod.zip
    GH->>CD: CreateDeployment (bundle: deploy-prod.zip)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Assessment against linked issues

Objective Addressed Explanation
gdgoc 패키지 내부 내용을 상단으로 올리기 (#190)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
테스트 스켈레톤 추가: src/test/java/inha/gdgoc/domain/recruit/service/RecruitMemberServiceTest.java 리팩터링(구조 상향 이동) 요구사항과 직접적인 관련 없음; 테스트가 미완성(서비스 호출/Assertion 없음).
.dockerignore 추가 (.dockerignore) 프로젝트 구조 변경(#190)의 핵심 목표(패키지 상단 이동)와 직접 관련 없음 — Docker 빌드 컨텍스트 최적화 목적의 보완 변경임.

Possibly related PRs

Poem

깡총깡총, 루트로 점프했지요
폴더는 한 몸이 되고, 빌드는 가벼워졌지요
도커는 작게, JRE는 빠르게 뛰고
AWS는 토끼손에 키를 쥐고
zip 둘로 나눠 배포—출발! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dab9cb9 and 6cbb165.

📒 Files selected for processing (1)
  • .gitignore (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .gitignore
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/issue-190

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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
Copy link

github-actions bot commented Aug 24, 2025

CI status
✅ Assemble 성공
✅ Test 성공

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/resources/application-local.yml (1)

51-52: 로그 카테고리 타이포: org.hibername.type → org.hibernate.type

오타로 인해 Hibernate 타입 바인딩 로그 레벨이 적용되지 않습니다. 디버깅 가용성 저하를 방지하려면 즉시 수정하세요.

 logging:
   level:
     org.hibernate.SQL: debug
-    org.hibername.type: trace
+    org.hibernate.type: trace
🧹 Nitpick comments (12)
.github/workflows/ci.yml (2)

42-47: Gradle 빌드 단계 개선 제안: 실패 시 로그 보존 및 빌드 캐시 활성화

tee build.log는 유용하나, 워크플로 종료 시 로그가 유실될 수 있습니다. 실패 시 아티팩트 업로드를 추가하고, 가능하다면 빌드 캐시를 활성화하여 반복 빌드 시간을 단축하세요.

  • 캐시: ./gradlew build -x test --build-cache ...
  • 실패 로그 업로드(추가 스텝 예시):
# (파일 내 적절한 위치에 추가)
- name: Upload logs on failure
  if: ${{ failure() }}
  uses: actions/upload-artifact@v4
  with:
    name: gradle-logs
    path: |
      build.log
      test.log
    if-no-files-found: ignore
    retention-days: 7

60-60: 테스트 단계도 동일한 개선 권장

테스트 로그도 실패 시 업로드되도록 위 아티팩트 스텝이 함께 커버됩니다. 추가로 H2 모드 설정은 적절하나, Flyway를 끄고 JPA create-drop을 쓰는 현재 구성이 실제 테스트 의도(스키마/데이터 마이그레이션 검증)와 부합하는지 확인 바랍니다.

src/test/java/inha/gdgoc/domain/recruit/service/RecruitMemberServiceTest.java (2)

6-21: 검증·캡처를 위해 필요한 import가 빠졌습니다.

ArgumentCaptor와(또는) Answer 등을 사용할 계획이라면 관련 import를 추가하세요. 최소한 ArgumentCaptor는 필요합니다.

예시:

 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.ArgumentCaptor;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;

55-69: savedMember 빌드는 현재로서는 미사용입니다. 반환 stubbing 또는 제거가 필요합니다.

위 코멘트처럼 when(recruitMemberRepository.save(...)).thenReturn(savedMember);로 활용하거나, 그렇지 않다면 블록 자체를 제거해 주세요.

Dockerfile (3)

18-18: 부트 JAR 선택을 더 결정적으로 바꿔 ‘-plain.jar’ 오탐을 방지하세요.

현재 ls ... | head -n 1은 비결정적일 수 있습니다. *-plain.jar를 제외하고 첫 파일을 복사하도록 변경을 권장합니다.

-RUN cp "$(ls build/libs/*.jar | head -n 1)" build/libs/app.jar
+RUN cp "$(find build/libs -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' -print -quit)" build/libs/app.jar

21-27: 컨테이너를 비루트 사용자로 실행하여 기본 보안을 강화하세요.

런타임 스테이지에서 전용 유저를 생성하고 USER를 설정하면 권한 상승 위험을 낮출 수 있습니다.

 FROM eclipse-temurin:17-jre
 WORKDIR /app
 
 COPY --from=build /app/build/libs/app.jar app.jar
 
+RUN useradd -r -u 1001 -g root appuser
+USER 1001
 EXPOSE 8080
 ENTRYPOINT ["java","-jar","/app/app.jar"]

7-12: 레이어 캐시 최적화(선택): Gradle 래퍼/의존 파일만 먼저 복사하세요.

COPY . . 이전에 gradlew, gradle/wrapper/**, build.gradle*, settings.gradle만 먼저 복사하고 종속성 다운로드를 분리하면, 애플리케이션 코드 변경 시 빌드 캐시 활용도가 크게 올라갑니다.

필요 시 단계별 COPY와 --mount=type=cache(BuildKit) 사용을 함께 고려해 주세요.

.github/workflows/deploy-prod.yml (3)

63-67: GitHub→AWS 자격 연계는 OIDC로 전환을 권장합니다(장기 키 제거).

현재 aws-actions/configure-aws-credentials@v4에 정적 키를 공급하고 있습니다. OIDC(어설션 기반)로 전환하면 GitHub Secrets에 장기 키를 보관할 필요가 없어집니다.

전환 스케치:

permissions:
  id-token: write
  contents: read

- uses: aws-actions/configure-aws-credentials@v4
  with:
-   aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
-   aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    aws-region: ${{ secrets.AWS_REGION }}
+   role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
+   role-session-name: github-actions

24-28: 빌드 캐시/멀티 아키텍처가 필요하면 build-push-action 사용을 고려하세요.

단일 docker build도 충분하지만, 캐시/멀티플랫폼이 필요하면 docker/build-push-action@v6로 이관해 성능과 재현성을 높일 수 있습니다.


58-58: YAML trailing space 경고를 수정하세요.

YAMLlint가 줄 끝 공백을 보고했습니다. 단순 제거만으로 경고를 없앨 수 있습니다.

-          
+
.github/workflows/deploy-dev.yml (2)

22-26: Dev 이미지에도 커밋 SHA 태깅을 추가해 롤백·추적성을 높이세요.

현재 latest만 푸시합니다. SHA 태그를 병행하면 특정 배포 버전 추적이 쉬워집니다.

-      - name: Build and Push Docker Image
-        run: |
-          docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/gdgoc-be-app-dev:latest .
-          docker push ${{ secrets.DOCKER_HUB_USERNAME }}/gdgoc-be-app-dev:latest
+      - name: Build and Push Docker Image
+        run: |
+          IMAGE=${{ secrets.DOCKER_HUB_USERNAME }}/gdgoc-be-app-dev
+          TAG=${{ github.sha }}
+          docker build -t $IMAGE:latest -t $IMAGE:$TAG .
+          docker push $IMAGE:latest
+          docker push $IMAGE:$TAG

55-55: YAML trailing space 경고를 수정하세요.

불필요한 공백만 제거하면 됩니다.

-        
+
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b16b8b9 and 650f1df.

⛔ Files ignored due to path filters (1)
  • gradle/wrapper/gradle-wrapper.jar is excluded by !**/*.jar
📒 Files selected for processing (10)
  • .dockerignore (1 hunks)
  • .github/workflows/ci.yml (3 hunks)
  • .github/workflows/deploy-dev.yml (1 hunks)
  • .github/workflows/deploy-prod.yml (1 hunks)
  • .gitignore (1 hunks)
  • Dockerfile (1 hunks)
  • gdgoc/settings.gradle (0 hunks)
  • settings.gradle (1 hunks)
  • src/main/resources/application-local.yml (1 hunks)
  • src/test/java/inha/gdgoc/domain/recruit/service/RecruitMemberServiceTest.java (1 hunks)
💤 Files with no reviewable changes (1)
  • gdgoc/settings.gradle
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/deploy-prod.yml

[error] 58-58: trailing spaces

(trailing-spaces)

.github/workflows/deploy-dev.yml

[error] 55-55: trailing spaces

(trailing-spaces)

🔇 Additional comments (6)
settings.gradle (1)

1-1: 검토 완료: bootJar 기본 산출물과 Dockerfile의 app.jar 복사 로직이 일치합니다.

  • ./gradlewgradle-wrapper.jar 모두 정상 확인
  • Gradle 설정에서 bootJararchiveFileName을 명시적으로 변경한 부분이 없어 기본 산출물명이 사용됨
  • Dockerfile의 ls build/libs/*.jar | head -n 1build/libs/app.jar 복사 로직이 모든 버전의 JAR 파일명을 app.jar로 일관되게 처리함

위 검증 결과, Gradle 산출물명과 Dockerfile 참조가 일치하므로 추가 조치는 필요 없습니다.

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

28-29: 형식 정리 OK — 동작 변화 없음

spring.flywaybaseline-on-migrate, baseline-version 주석 제거는 의미 변경이 없어 안전합니다. 실제 마이그레이션 시작 버전(V1__...)과 값(1)의 정합성만 확인해 주세요.

.github/workflows/ci.yml (2)

26-30: Temurin 17 설정 전환 LGTM

현 구조(루트 모듈)에서 JDK 17 세팅은 적절합니다. Gradle 캐시 및 setup-gradle@v3 조합도 표준입니다.


116-118: 종단 실패 게이트 유지 LGTM

조합 결과에 따라 명시적으로 실패 처리하는 종단 게이트는 의도에 부합합니다.

src/test/java/inha/gdgoc/domain/recruit/service/RecruitMemberServiceTest.java (1)

1-1: ApplicationRequest 인스턴스 생성 방식 명확화

  • 확인 결과 ApplicationRequest 클래스에는 @Builder 또는 정적 팩토리 메서드가 정의되어 있지 않습니다. 대신 Lombok의 @AllArgsConstructor가 붙어 있어 모든 필드를 인자로 받는 생성자가 제공됩니다.
    • 위치: src/main/java/inha/gdgoc/domain/recruit/dto/request/ApplicationRequest.java (lines 9–13)
  • 테스트에서 실제 인스턴스를 생성해야 할 경우, 아래와 같이 생성자를 직접 호출하세요.
    ApplicationRequest request = new ApplicationRequest(member, answers);
  • 빌더 패턴 형태의 인스턴스화를 선호한다면, DTO 클래스에 Lombok의 @Builder 어노테이션을 추가하여 빌더 메서드를 제공할 수 있습니다. (선택 사항)

Likely an incorrect or invalid review comment.

Dockerfile (1)

14-16: Gradle wrapper 사용 관점에서 빌드 커맨드는 적절합니다.

CI에서 테스트를 실행하므로 -x test도 합리적이고, bootJar를 명시하여 실행 JAR만 산출하도록 한 점 좋습니다.

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 (1)
.dockerignore (1)

1-9: 비밀/인증서/클라우드 자격과 압축 아카이브까지 추가로 제외해 컨텍스트를 더 안전하고 작게 만드세요.

다음 패턴은 실무에서 자주 누락되어 민감정보가 컨텍스트로 섞이거나, 빌드 컨텍스트가 불필요하게 비대해지는 원인입니다. 선택적으로 추가를 권장합니다.

 .git
 .gradle
 build
 *.log
 .DS_Store
 .env
 *.env
 **/*.env
+ .env.*
+ **/.env.*
+ .secrets/
+ **/*.pem
+ **/*.key
+ **/*.crt
+ **/*.p12
+ .aws/
+ .terraform/
+ **/.DS_Store
+ *.tar
+ *.tar.gz
 deploy-*.zip
+ .idea/
+ .vscode/
+ .github/
  • .env.*/**/.env.*: .env.local, .env.prod 등도 확실히 제외
  • *.pem|*.key|*.crt|*.p12: TLS/서명 키류
  • .aws/, .terraform/: 로컬 자격/상태 유출 방지
  • *.tar*: 대용량 아카이브 컨텍스트 혼입 방지
  • IDE 폴더와 .github/는 빌드에 불필요한 경우가 대부분이라 제외 권장
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 650f1df and dab9cb9.

📒 Files selected for processing (2)
  • .dockerignore (1 hunks)
  • .gitignore (1 hunks)
🔇 Additional comments (3)
.dockerignore (1)

1-9: 현재 규칙은 목적에 부합합니다 (컨텍스트 슬림화 + 비밀 유출 방지).

  • .git, .gradle, build, 로그, .DS_Store, 다양한 .env 패턴, deploy-*.zip 제외는 Docker 빌드 컨텍스트를 잘 줄이고, 민감정보 전송 위험도 낮춥니다. 이전 리뷰 지적사항도 반영되었습니다.
.gitignore (2)

6-6: Gradle Wrapper JAR 재포함 규칙이 정확합니다.

!gradle/wrapper/gradle-wrapper.jar로 올바르게 고정되어 Wrapper 누락으로 인한 초기 빌드 실패를 예방합니다.


7-8: .gitignore 재-include 규칙 검증 완료
현재 리포지토리에는 ./src/main./src/test 디렉터리만 존재하므로
!src/main/**/build/!src/test/**/build/ 패턴이 의도대로 동작합니다.

  • 발견된 경로
    • FOUND: ./src/main
    • FOUND: ./src/test
  • 루트 외 추가 모듈(src/...) 디렉터리 없음
  • 현 단일 모듈 구조에선 문제 없음

다만, 예제나 툴링용 서브모듈 등으로 추가 src/main/src/test 디렉터리가 생길 경우, 해당 패턴이 자동 재포함되지 않을 수 있으므로 멀티모듈 전환 시 재검토를 권장드립니다.

@kaswhy kaswhy merged commit 96820e3 into develop Aug 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 프로젝트 구조 변경

2 participants