Skip to content

Commit

Permalink
Se 4219 add build workflow (mozilla#15725)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Basma1912 authored Dec 16, 2024
1 parent a964025 commit d59b4fa
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |-
Expand Down

0 comments on commit d59b4fa

Please sign in to comment.