From d59b4fa29516156da0652d5159c45bc93b5d881e Mon Sep 17 00:00:00 2001 From: Basma A Date: Mon, 16 Dec 2024 13:33:42 -0500 Subject: [PATCH] Se 4219 add build workflow (#15725) * chore(githubAction): add build workflow initial work for argocd move * fix description of the push step * add prod gha runner to the workflow * only use prod runner * change the github runner * remove cd src * makes some changes to the steps ids * add buildx * add docker pull * use the correct gar repo --------- Signed-off-by: Basma1912 --- .github/workflows/build-and-push.yml | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index d13b671bb61..43fa2e00d79 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -22,7 +22,7 @@ env: IMAGE: bedrock GAR_LOCATION: us GCP_PROJECT_ID: moz-fx-bedrock-prod - GAR_REPOSITORY: bedrock + GAR_REPOSITORY: bedrock-prod REF_ID: ${{ github.ref }} @@ -69,7 +69,6 @@ jobs: name: Push Image to GAR needs: build_and_publish_public_images runs-on: ubuntu-latest - environment: build permissions: contents: read id-token: write @@ -132,6 +131,8 @@ jobs: echo DEPLOYMENT_ENV=prod >> "$GITHUB_ENV" echo DEPLOYMENT_REALM=prod >> "$GITHUB_ENV" + - uses: docker/setup-buildx-action@v3 + - id: gcp_auth name: GCP authentication uses: google-github-actions/auth@v2 @@ -140,22 +141,22 @@ jobs: service_account: artifact-writer@${{ env.GCP_PROJECT_ID }}.iam.gserviceaccount.com workload_identity_provider: ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }} - - uses: docker/login-action@v3 + - id: docker_login + uses: docker/login-action@v3 name: Docker login with: registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev username: oauth2accesstoken - password: ${{ steps.gcp-auth.outputs.access_token }} + password: ${{ steps.gcp_auth.outputs.access_token }} - id: push-existing-image-to-gar name: Push existing stage image to GAR run: |- + docker pull mozmeao/bedrock:${{ needs.build_and_publish_public_images.outputs.long_sha }} docker tag mozmeao/bedrock:${{ needs.build_and_publish_public_images.outputs.long_sha }} ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY}}/${{ env.IMAGE }}:${{ env.TAG }} docker push ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY}}/${{ env.IMAGE }}:${{ env.TAG }} - - upload_static_assets: name: Upload static assets runs-on: ubuntu-latest @@ -166,13 +167,6 @@ jobs: id-token: write steps: - - id: checkout-application-repo - uses: actions/checkout@v4 - with: - path: src - repository: ${{ env.APPLICATION_REPOSITORY }} - ref: ${{ env.REF }} - - id: gcp_auth name: gcp auth uses: google-github-actions/auth@v2 @@ -195,13 +189,6 @@ jobs: with: version: 413.0.0 - - uses: docker/login-action@v3 - name: Docker login - with: - registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev - username: oauth2accesstoken - password: ${{ steps.gcp-auth.outputs.access_token }} - - id: upload-assets name: upload static assets run: |-