diff --git a/.github/PULL_REQUEST_TEMPLATE/why-what-how.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/PULL_REQUEST_TEMPLATE/why-what-how.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE/standard.md b/.github/PULL_REQUEST_TEMPLATE/standard.md deleted file mode 100644 index 90659791..00000000 --- a/.github/PULL_REQUEST_TEMPLATE/standard.md +++ /dev/null @@ -1,14 +0,0 @@ -## #️⃣연관된 이슈 -> close # - -## 📝작업 내용 -> 작업한 내용을 작성해주세요. - -## 🔎코드 설명 -> 코드에 대한 설명을 작성해주세요. - -## 💬고민사항 및 리뷰 요구사항 -> 고민사항 및 의견 받고 싶은 부분 있으면 적어두기 - -## 비고 (Optional) -> 참고했던 링크 등 참고 사항을 적어주세요. 코드 리뷰하는 사람이 참고해야 하는 내용을 자유로운 형식으로 적을 수 있습니다. diff --git a/.github/workflows/ci-prd.yaml b/.github/workflows/ci-prd.yaml index cae027c1..e9eae462 100644 --- a/.github/workflows/ci-prd.yaml +++ b/.github/workflows/ci-prd.yaml @@ -13,7 +13,7 @@ jobs: SPRING_PROFILES_ACTIVE: test steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: recursive token: ${{ secrets.PAT }} @@ -25,7 +25,7 @@ jobs: distribution: 'temurin' - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + uses: gradle/actions/setup-gradle@v5 - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -34,46 +34,79 @@ jobs: run: ./gradlew clean build --info --stacktrace --no-daemon - name: Docker login - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set image tag id: vars run: echo "IMAGE_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV - - name: Build Docker image - run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/startuplight-be:${{ env.IMAGE_TAG }} -f deploy/Dockerfile . - - - name: Docker Hub push - run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/startuplight-be:${{ env.IMAGE_TAG }} + # Multi-architecture 빌드 및 푸시 + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: deploy/Dockerfile + platforms: linux/amd64,linux/arm64 # 두 아키텍처 모두 빌드 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/startuplight-be:${{ env.IMAGE_TAG }} + cache-from: type=gha + cache-to: type=gha,mode=max - name: Checkout manifest repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: 'StartUpLight/STARLIGHT_MANIFEST' token: ${{ secrets.PAT }} path: 'manifest' - - name: Update deployment.yml + - name: Update deployment.yml and push manifest env: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} IMAGE_TAG: ${{ env.IMAGE_TAG }} run: | - sed -i "s|image:.*|image: ${DOCKERHUB_USERNAME}/startuplight-be:${IMAGE_TAG}|g" manifest/production/deployment.yml - - # 변경사항 확인 - echo "Updated deployment.yml:" - cat manifest/production/deployment.yml + update_manifest() { + local dir="$1" + local file="$dir/production/deployment.yml" - - name: Commit and push changes - env: - IMAGE_TAG: ${{ env.IMAGE_TAG }} - run: | - cd manifest - git config --local user.email "kjeng7897@gmail.com" - git config --local user.name "SeongHo5356" - git add production/deployment.yml - git commit -m "Update image tag to $IMAGE_TAG" || exit 0 - git push \ No newline at end of file + sed -i "s|image:.*|image: ${DOCKERHUB_USERNAME}/startuplight-be:${IMAGE_TAG}|g" "$file" + echo "Updated $file:" + cat "$file" + + git -C "$dir" config --local user.email "kjeng7897@gmail.com" + git -C "$dir" config --local user.name "SeongHo5356" + git -C "$dir" add production/deployment.yml + + if [ -z "$(git -C "$dir" status --porcelain)" ]; then + echo "No changes to commit in $dir" + return 0 + fi + + git -C "$dir" commit -m "Update image tag to $IMAGE_TAG" + + for i in {1..3}; do + echo "Push attempt $i for $dir" + git -C "$dir" pull --rebase origin main && \ + git -C "$dir" push && \ + echo "Successfully pushed $dir" && \ + break || { + echo "Push failed for $dir, retrying in 2 seconds..." + sleep 2 + } + done + + if ! git -C "$dir" diff --quiet origin/main HEAD; then + echo "ERROR: Failed to push $dir after 3 attempts" + return 1 + fi + } + + update_manifest manifest diff --git a/.github/workflows/ci-stg.yaml b/.github/workflows/ci-stg.yaml index a25647ce..dcdeeb19 100644 --- a/.github/workflows/ci-stg.yaml +++ b/.github/workflows/ci-stg.yaml @@ -13,7 +13,7 @@ jobs: SPRING_PROFILES_ACTIVE: test steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: recursive token: ${{ secrets.PAT }} @@ -25,7 +25,7 @@ jobs: distribution: 'temurin' - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + uses: gradle/actions/setup-gradle@v5 - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -33,25 +33,25 @@ jobs: - name: Build with Gradle Wrapper run: ./gradlew clean build --info --stacktrace --no-daemon - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Docker login uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set image tag id: vars run: echo "IMAGE_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV # Multi-architecture 빌드 및 푸시 - name: Build and push Docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . file: deploy/Dockerfile @@ -62,30 +62,59 @@ jobs: cache-to: type=gha,mode=max - name: Checkout manifest repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: 'StartUpLight/STARLIGHT_MANIFEST' token: ${{ secrets.PAT }} path: 'manifest' - - name: Update deployment.yml + - name: Checkout manifest repository (oracle) + uses: actions/checkout@v6 + with: + repository: 'StartUpLight/STARLIGHT_MANIFEST_ORACLE' + token: ${{ secrets.PAT }} + path: 'manifest-oracle' + + - name: Update deployment.yml and push manifests env: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} IMAGE_TAG: ${{ env.IMAGE_TAG }} run: | - sed -i "s|image:.*|image: ${DOCKERHUB_USERNAME}/startuplight-be:${IMAGE_TAG}|g" manifest/staging/deployment.yml - - # 변경사항 확인 - echo "Updated deployment.yml:" - cat manifest/staging/deployment.yml + update_manifest() { + local dir="$1" + local file="$dir/staging/deployment.yml" - - name: Commit and push changes - env: - IMAGE_TAG: ${{ env.IMAGE_TAG }} - run: | - cd manifest - git config --local user.email "kjeng7897@gmail.com" - git config --local user.name "SeongHo5356" - git add staging/deployment.yml - git commit -m "Update image tag to $IMAGE_TAG" || exit 0 - git push \ No newline at end of file + sed -i "s|image:.*|image: ${DOCKERHUB_USERNAME}/startuplight-be:${IMAGE_TAG}|g" "$file" + echo "Updated $file:" + cat "$file" + + git -C "$dir" config --local user.email "kjeng7897@gmail.com" + git -C "$dir" config --local user.name "SeongHo5356" + git -C "$dir" add staging/deployment.yml + + if [ -z "$(git -C "$dir" status --porcelain)" ]; then + echo "No changes to commit in $dir" + return 0 + fi + + git -C "$dir" commit -m "Update image tag to $IMAGE_TAG" + + for i in {1..3}; do + echo "Push attempt $i for $dir" + git -C "$dir" pull --rebase origin main && \ + git -C "$dir" push && \ + echo "Successfully pushed $dir" && \ + break || { + echo "Push failed for $dir, retrying in 2 seconds..." + sleep 2 + } + done + + if ! git -C "$dir" diff --quiet origin/main HEAD; then + echo "ERROR: Failed to push $dir after 3 attempts" + return 1 + fi + } + + update_manifest manifest + update_manifest manifest-oracle diff --git a/config b/config index 3a581e52..6e61b815 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit 3a581e527b6117d5929ba57a0e2c8c8b90d9d14a +Subproject commit 6e61b8157725b24821dff68581c6a45dadad98d1