From b3b5fdd366aeeab86b61d42a0b651bedee666117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EB=8F=99=EA=B7=BC?= <67232422+yudonggeun@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:52:49 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"[CI/CD]=20=EC=9B=90=ED=95=A0=ED=95=9C?= =?UTF-8?q?=20=EB=B0=B0=ED=8F=AC=EB=A5=BC=20=EC=9C=84=ED=95=9C=20Github=20?= =?UTF-8?q?Actions=20Workflow=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{ci/server.yml => ci.yml} | 45 +++++------ .github/workflows/ci/auth.yml | 82 --------------------- .github/workflows/ci/front.yml | 70 ------------------ .github/workflows/ci/user.yml | 82 --------------------- 4 files changed, 23 insertions(+), 256 deletions(-) rename .github/workflows/{ci/server.yml => ci.yml} (57%) delete mode 100644 .github/workflows/ci/auth.yml delete mode 100644 .github/workflows/ci/front.yml delete mode 100644 .github/workflows/ci/user.yml diff --git a/.github/workflows/ci/server.yml b/.github/workflows/ci.yml similarity index 57% rename from .github/workflows/ci/server.yml rename to .github/workflows/ci.yml index 00d2349e..e90b7e08 100644 --- a/.github/workflows/ci/server.yml +++ b/.github/workflows/ci.yml @@ -1,39 +1,32 @@ -name: Server micro service CI +name: CI on: - workflow_dispatch: - inputs: - version: - description: '배포하고자 하는 버전을 입력해주세요. 최신 버전이라면 생략해주세요. (git commit id 앞 8자리)' - default: 'latest' + push: + branches: [ main ] # push 되었을 때, 실행 jobs: build: - if: github.event.inputs.version == 'latest' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: checkout - run: git checkout ${{ github.event.inputs.version }} - - name: set up jdk 21 uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '21' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: make api documents - run: ./gradlew --info server:openapi3 + run: ./gradlew --info openapi3 - name: configure openapi3 spec run: | @@ -41,9 +34,19 @@ jobs: yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./server/src/main/resources/static/openapi3.yaml yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./server/src/main/resources/static/openapi3.yaml yq eval -i '.security[0].bearerAuth = []' ./server/src/main/resources/static/openapi3.yaml + + yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./user/src/main/resources/static/openapi3.yaml + yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./user/src/main/resources/static/openapi3.yaml + yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./user/src/main/resources/static/openapi3.yaml + yq eval -i '.security[0].bearerAuth = []' ./user/src/main/resources/static/openapi3.yaml + + yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./auth/src/main/resources/static/openapi3.yaml + yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./auth/src/main/resources/static/openapi3.yaml + yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./auth/src/main/resources/static/openapi3.yaml + yq eval -i '.security[0].bearerAuth = []' ./auth/src/main/resources/static/openapi3.yaml - name: push image using jib - run: ./gradlew --info server:jib + run: ./gradlew --info jib tagging: needs: @@ -53,11 +56,7 @@ jobs: - name: checkout uses: actions/checkout@v4 - - if: github.event.inputs.version != 'latest' - name: checkout - run: git checkout ${{ github.event.inputs.version }} - - - name: set image tag + - name: set tag run: | echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV @@ -68,10 +67,12 @@ jobs: ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} ref: main - - name: edit infra repository image tag + - name: edit infra repository tag run: | echo 'env(IMAGE_TAG)' yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/server/values.yaml + yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/user/values.yaml + yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/auth/values.yaml - name: commit uses: leigholiver/commit-with-deploy-key@v1.0.4 @@ -79,4 +80,4 @@ jobs: source: . destination_repo: kSideProject/kpring-infra deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} - commit_message: 'ci: update server image version=${{ github.event.inputs.version }}' + commit_message: 'ci: update tag to env(IMAGE_TAG)' diff --git a/.github/workflows/ci/auth.yml b/.github/workflows/ci/auth.yml deleted file mode 100644 index c5af030a..00000000 --- a/.github/workflows/ci/auth.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Auth micro service CI - -on: - workflow_dispatch: - inputs: - version: - description: '배포하고자 하는 버전을 입력해주세요. 최신 버전이라면 생략해주세요. (git commit id 앞 8자리)' - default: 'latest' - -jobs: - build: - if: github.event.inputs.version == 'latest' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: checkout - run: git checkout ${{ github.event.inputs.version }} - - - name: set up jdk 21 - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: '21' - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: make api documents - run: ./gradlew --info auth:openapi3 - - - name: configure openapi3 spec - run: | - yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./auth/src/main/resources/static/openapi3.yaml - yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./auth/src/main/resources/static/openapi3.yaml - yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./auth/src/main/resources/static/openapi3.yaml - yq eval -i '.security[0].bearerAuth = []' ./auth/src/main/resources/static/openapi3.yaml - - - name: push image using jib - run: ./gradlew --info auth:jib - - tagging: - needs: - - build - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 - - - if: github.event.inputs.version != 'latest' - name: checkout - run: git checkout ${{ github.event.inputs.version }} - - - name: set image tag - run: | - echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV - - - name: checkout infra repository - uses: actions/checkout@v4 - with: - repository: kSideProject/kpring-infra - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - ref: main - - - name: edit infra repository image tag - run: | - echo 'env(IMAGE_TAG)' - yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/auth/values.yaml - - - name: commit - uses: leigholiver/commit-with-deploy-key@v1.0.4 - with: - source: . - destination_repo: kSideProject/kpring-infra - deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} - commit_message: 'ci: update auth image version=${{ github.event.inputs.version }}' diff --git a/.github/workflows/ci/front.yml b/.github/workflows/ci/front.yml deleted file mode 100644 index 82b7fea1..00000000 --- a/.github/workflows/ci/front.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Frontend Nginx micro service CI - -on: - workflow_dispatch: - inputs: - version: - description: '배포하고자 하는 버전을 입력해주세요. 최신 버전이라면 생략해주세요. (git commit id 앞 8자리)' - default: 'latest' - -jobs: - build: - if: github.event.inputs.version == 'latest' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: checkout - run: git checkout ${{ github.event.inputs.version }} - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - # Build Docker image - - name: Build Docker Image - run: | - docker build -t kpring/front_app:$(git rev-parse --short=8 HEAD) . - - # Push Docker image to DockerHub - - name: Push Docker Image to DockerHub - run: | - docker push kpring/front_app:$(git rev-parse --short=8 HEAD) - - tagging: - needs: - - build - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 - - - if: github.event.inputs.version != 'latest' - name: checkout - run: git checkout ${{ github.event.inputs.version }} - - - name: set image tag - run: | - echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV - - - name: checkout infra repository - uses: actions/checkout@v4 - with: - repository: kSideProject/kpring-infra - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - ref: main - - - name: edit infra repository image tag - run: | - echo 'env(IMAGE_TAG)' - yq eval -i '.image.tag = env(IMAGE_TAG)' ./charts/front/values.yaml - - - name: commit - uses: leigholiver/commit-with-deploy-key@v1.0.4 - with: - source: . - destination_repo: kSideProject/kpring-infra - deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} - commit_message: 'ci: update frontend image version=${{ github.event.inputs.version }}' diff --git a/.github/workflows/ci/user.yml b/.github/workflows/ci/user.yml deleted file mode 100644 index fb43c188..00000000 --- a/.github/workflows/ci/user.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: User micro service CI - -on: - workflow_dispatch: - inputs: - version: - description: '배포하고자 하는 버전을 입력해주세요. 최신 버전이라면 생략해주세요. (git commit id 앞 8자리)' - default: 'latest' - -jobs: - build: - if: github.event.inputs.version == 'latest' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: checkout - run: git checkout ${{ github.event.inputs.version }} - - - name: set up jdk 21 - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: '21' - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: make api documents - run: ./gradlew --info user:openapi3 - - - name: configure openapi3 spec - run: | - yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./user/src/main/resources/static/openapi3.yaml - yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./user/src/main/resources/static/openapi3.yaml - yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./user/src/main/resources/static/openapi3.yaml - yq eval -i '.security[0].bearerAuth = []' ./user/src/main/resources/static/openapi3.yaml - - - name: push image using jib - run: ./gradlew --info user:jib - - tagging: - needs: - - build - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 - - - if: github.event.inputs.version != 'latest' - name: checkout - run: git checkout ${{ github.event.inputs.version }} - - - name: set image tag - run: | - echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV - - - name: checkout infra repository - uses: actions/checkout@v4 - with: - repository: kSideProject/kpring-infra - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - ref: main - - - name: edit infra repository image tag - run: | - echo 'env(IMAGE_TAG)' - yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/user/values.yaml - - - name: commit - uses: leigholiver/commit-with-deploy-key@v1.0.4 - with: - source: . - destination_repo: kSideProject/kpring-infra - deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} - commit_message: 'ci: update user image version=${{ github.event.inputs.version }}'