diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index b7c3afa..835f435 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -1,4 +1,4 @@ -name: Build and deploy +name: Build And Deploy on: push: branches: @@ -10,6 +10,7 @@ on: env: SERVICE: tks-batch TAG: ${{github.sha}} + REGISTRY: harbor.taco-cat.xyz jobs: build-deploy: @@ -24,8 +25,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{secrets.DOCKERHUB_USERNAME}} - password: ${{secrets.DOCKERHUB_TOKEN}} + registry: ${{env.REGISTRY}} + username: ${{secrets.HARBOR_USERNAME}} + password: ${{secrets.HARBOR_SECRET}} - name: Build and Push id: docker_build @@ -33,7 +35,7 @@ jobs: with: push: true tags: | - sktcloud/${{env.SERVICE}}:${{env.TAG}} + ${{env.REGISTRY}}/tks/${{env.SERVICE}}:${{env.TAG}} - name: Setup Kustomize uses: imranismail/setup-kustomize@v1 @@ -46,12 +48,12 @@ jobs: git clone "https://${{secrets.BOT_GITHUB_TOKEN}}@github.com/openinfradev/cicd-manifests.git" if [[ ${{github.ref}} == *"develop"* ]]; then - ( cd cicd-manifests/${SERVICE}/overlay/development && kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG} && git add kustomization.yaml ) + ( cd cicd-manifests/${SERVICE}/overlay/development && kustomize edit set image ${REGISTRY}/tks/${SERVICE}:${TAG} && git add kustomization.yaml ) elif [[ ${{github.ref}} == *"release"* ]]; then - ( cd cicd-manifests/${SERVICE}/overlay/ft && kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG} && git add kustomization.yaml ) + ( cd cicd-manifests/${SERVICE}/overlay/ft && kustomize edit set image ${REGISTRY}/tks/${SERVICE}:${TAG} && git add kustomization.yaml ) elif [[ ${{github.ref}} == *"main"* ]]; then - ( cd cicd-manifests/${SERVICE}/overlay/cicd && kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG} && git add kustomization.yaml ) - ( cd cicd-manifests/${SERVICE}/overlay/prd && kustomize edit set image docker.io/sktcloud/${SERVICE}:${TAG} && git add kustomization.yaml ) + ( cd cicd-manifests/${SERVICE}/overlay/cicd && kustomize edit set image ${REGISTRY}/tks/${SERVICE}:${TAG} && git add kustomization.yaml ) + ( cd cicd-manifests/${SERVICE}/overlay/prd && kustomize edit set image ${REGISTRY}/tks/${SERVICE}:${TAG} && git add kustomization.yaml ) fi cd cicd-manifests diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 75e66f7..220bba1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,18 @@ -name: Build only +name: Build Image on: - pull_request: + pull_request_target: + branches: + - main + - develop + - release env: SERVICE: tks-batch TAG: ${{github.sha}} + REGISTRY: harbor.taco-cat.xyz jobs: - build-and-push-image: + build-image: runs-on: ubuntu-latest steps: - name: Checkout @@ -16,13 +21,14 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ${{env.REGISTRY}} + username: ${{secrets.HARBOR_USERNAME}} + password: ${{secrets.HARBOR_SECRET}} - name: build image id: docker_build @@ -30,4 +36,4 @@ jobs: with: push: false tags: | - sktcloud/${{env.SERVICE}}:${{env.TAG}} + tks/${{env.SERVICE}}:${{env.TAG}}