-
Notifications
You must be signed in to change notification settings - Fork 13
Updated circleci config to push to gar #573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
2b5585d
0e56d85
936bc47
cb5dc13
c1cbf0f
fad6870
8469374
765acd5
87ad71c
48ebec2
119ae60
00a940e
53fb56a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ executors: | |
|
|
||
| orbs: | ||
| shellcheck: circleci/shellcheck@3.0.0 | ||
| gcp-cli: circleci/gcp-cli@3.3.0 | ||
| gcp-gcr: circleci/gcp-gcr@0.16.3 | ||
|
|
||
| commands: | ||
| checkout-and-dependencies: | ||
|
|
@@ -60,7 +62,16 @@ workflows: | |
| only: | ||
| - master | ||
| - production | ||
|
|
||
| - deploy-gar: | ||
bwells-moz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| requires: | ||
| - docker | ||
| context: | ||
| - gcpv2-workload-identity | ||
| # filters: | ||
| # branches: | ||
| # only: | ||
| # - master | ||
| # - production | ||
| # This is a weekly workflow, just to deploy new versions of the docker images, | ||
| # so that updates to the underlying images are used and deployed. | ||
| # This is configured to run on Thursdays (4th day in the week, Sunday is 0). | ||
|
|
@@ -187,3 +198,40 @@ jobs: | |
| echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin | ||
| docker push $IMAGE_NAME:$IMAGE_LATEST_TAG | ||
| docker push $IMAGE_NAME:$IMAGE_VERSION_TAG | ||
| deploy-gar: | ||
| executor: gcp-gcr/default | ||
| parameters: | ||
| build_tag: | ||
| type: string | ||
| default: build | ||
| image: | ||
| type: string | ||
| default: firefoxprofiler | ||
| registry-url: | ||
| type: string | ||
| default: us-docker.pkg.dev | ||
bwells-moz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - checkout | ||
| - gcp-cli/setup: | ||
| use_oidc: true | ||
| - run: | ||
| name: Prepare environment variables for OIDC authentication and Deploy to Google Artifact Registry | ||
| command: | | ||
| echo 'export GOOGLE_PROJECT_ID="moz-fx-profiler-prod"' >> "$BASH_ENV" | ||
| echo "export OIDC_WIP_ID=$GCPV2_WORKLOAD_IDENTITY_POOL_ID" >> "$BASH_ENV" | ||
| echo "export OIDC_WIP_PROVIDER_ID=$GCPV2_CIRCLECI_WORKLOAD_IDENTITY_PROVIDER" >> "$BASH_ENV" | ||
| echo "export GOOGLE_PROJECT_NUMBER=$GCPV2_WORKLOAD_IDENTITY_POOL_PROJECT_NUMBER" >> "$BASH_ENV" | ||
| echo "export OIDC_SERVICE_ACCOUNT_EMAIL=$GCP_SERVICE_ACCOUNT_EMAIL" >> "$BASH_ENV" | ||
bwells-moz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo 'export GCP_GAR_REPO="profiler-prod"' >> "$BASH_ENV" | ||
| echo "export GAR_IMAGE=\"<<parameters.registry-url>>/${GOOGLE_PROJECT_ID}/${GCP_GAR_REPO}/<<parameters.image>>\"" >> $BASH_ENV | ||
|
Comment on lines
+220
to
+226
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For more simplicity, and if they are needed, I would create these env variables directly in the step below, like we do for For the hardcoded ones, it could be easier to add an Using the commands with
But I'm not opposed keeping them here if you prefer, buy only if we need them. |
||
|
|
||
| gcloud auth configure-docker us-docker.pkg.dev --quiet | ||
|
|
||
| IMAGE_VERSION_TAG="0.0.${CIRCLE_BUILD_NUM}" | ||
| IMAGE_LATEST_TAG="${CIRCLE_BRANCH}-latest" | ||
|
|
||
| docker tag <<parameters.image>> $GAR_IMAGE:$IMAGE_VERSION_TAG | ||
| docker tag <<parameters.image>> $GAR_IMAGE:$IMAGE_LATEST_TAG | ||
|
|
||
| docker push $GAR_IMAGE:$IMAGE_VERSION_TAG | ||
| docker push $GAR_IMAGE:$IMAGE_LATEST_TAG | ||
Uh oh!
There was an error while loading. Please reload this page.