From 228a10646a0f160d0acc0b308697958e925a7c29 Mon Sep 17 00:00:00 2001 From: icurfer Date: Wed, 14 Jan 2026 01:35:56 +0900 Subject: [PATCH] Fix CI workflow: add Docker installation step - Match workflow format with other projects - Add Docker installation step for Gitea Actions runner - Use correct secrets names (DOCKER_ID, DOCKER_PW, ACTION_TOKEN) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/build.yaml | 91 ++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 71ec965..b940a25 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,48 +1,69 @@ -name: Build and Push Docker Image +name: Build And Test + +run-name: ${{ gitea.actor }} is runs ci pipeline on: push: - branches: - - main + branches: [ "main" ] pull_request: - branches: - - main + branches: [ "main" ] jobs: - build: + build-and-push: runs-on: ubuntu-latest steps: - - name: Checkout source code - uses: actions/checkout@v4 + - name: checkout source code + uses: actions/checkout@v3 - - name: Get version - id: version - run: echo "VERSION=$(cat version)" >> $GITHUB_OUTPUT + - name: Retrieve version + id: img-ver + uses: juliangruber/read-file-action@v1 + with: + path: ./version - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Install Docker + run: | + curl -fsSL https://get.docker.com -o get-docker.sh + sh get-docker.sh + if: runner.os == 'Linux' - - name: Login to Harbor Registry - uses: docker/login-action@v3 - with: - registry: harbor.icurfer.com - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_PASSWORD }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: harbor.icurfer.com/msa-demo/msa-django-nhn:${{ steps.version.outputs.VERSION }} + - name: Login to Registry + run: docker login -u ${{ secrets.DOCKER_ID }} -p ${{ secrets.DOCKER_PW }} https://harbor.icurfer.com - - name: Update Kubernetes manifests - run: | - git clone https://${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_TOKEN }}@github.com/${{ github.repository_owner }}/cd-msa-django-nhn.git - cd cd-msa-django-nhn - sed -i "s|harbor.icurfer.com/msa-demo/msa-django-nhn:.*|harbor.icurfer.com/msa-demo/msa-django-nhn:${{ steps.version.outputs.VERSION }}|g" kustomize/overlays/dev/kustomization.yaml - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - git add . - git commit -m "Update image tag to ${{ steps.version.outputs.VERSION }}" || echo "No changes to commit" - git push + - name: build + run: docker build -t harbor.icurfer.com/msa-demo/msa-django-nhn:${{ steps.img-ver.outputs.content }} . + + - name: Push to Docker + run: docker push harbor.icurfer.com/msa-demo/msa-django-nhn:${{ steps.img-ver.outputs.content }} + + ## pre cd + - name: Setup Kustomize + uses: yokawasa/action-setup-kube-tools@v0.9.2 + with: + kustomize: "3.7.0" + + - name: Checkout kustomize repository + uses: actions/checkout@v3 + with: + repository: "dev/cd-msa-django-nhn" + ref: main + token: ${{ secrets.ACTION_TOKEN }} + path: cd-msa-django-nhn + + - name: Update Kubernetes resources + run: | + cd cd-msa-django-nhn/overlays/dev/ + kustomize edit set image harbor.icurfer.com/msa-demo/msa-django-nhn:${{ steps.img-ver.outputs.content }} + cat kustomization.yaml + + ## cd commit + - name: Commit files + run: | + cd cd-msa-django-nhn + git config --global user.email "icurfer@gmail.com" + git config --global user.name "icurfer" + git commit -am "Update image tag" + git push -u origin main