Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -60,7 +62,15 @@ workflows:
only:
- master
- production

- deploy-gar:
name: Deploy to GAR
requires:
- docker
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).
Expand Down Expand Up @@ -187,3 +197,60 @@ 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
steps:
# gcr-auth parameters:
# https://circleci.com/developer/orbs/orb/circleci/gcp-gcr#commands-gcr-auth
- gcp-gcr/gcr-auth:
gcp_cred_config_file_path: ~/gcp_cred_config.json
google-project-id: GCP_GAR_PROJECT_ID
google_project_number: GCP_OIDC_PROJECT_NUMBER
registry-url: <<parameters.registry-url>>
service_account_email: GCP_OIDC_SERVICE_ACCOUNT_EMAIL
use_oidc: true
workload_identity_pool_id: GCP_OIDC_WIP_ID
workload_identity_pool_provider_id: GCP_OIDC_WIP_PROVIDER_ID
- attach_workspace:
at: /tmp/cache
- run:
name: Restore Docker image cache
command: docker load -i /tmp/cache/<<parameters.image>>.tar
# This is the easiest way to tag multiple images using different
# conditions for the GAR_TAG variable in the smallest amount of code.
#
# You can find other jobs and commands you can use with this orb that
# include tagging here:
# https://circleci.com/developer/orbs/orb/circleci/gcp-gcr
- run:
name: Tag image
command: |
if [ ! -z "${CIRCLE_TAG}" ]; then
echo "export GAR_TAG=${CIRCLE_TAG}" >> $BASH_ENV
else
echo "export GAR_TAG=${CIRCLE_BRANCH}" >> $BASH_ENV
fi
echo "export GAR_IMAGE=\"<<parameters.registry-url>>/${GCP_GAR_PROJECT_ID}/${GCP_GAR_REPO}/<<parameters.image>>\"" >> $BASH_ENV
source $BASH_ENV
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
# push-image parameters:
# https://circleci.com/developer/orbs/orb/circleci/gcp-gcr#commands-push-image
- gcp-gcr/push-image:
image: "${GCP_GAR_REPO}/<<parameters.image>>"
google-project-id: GCP_GAR_PROJECT_ID
registry-url: <<parameters.registry-url>>
tag: $IMAGE_VERSION_TAG,$IMAGE_VERSION_TAG
3 changes: 3 additions & 0 deletions scripts/store_git_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# version.json generated from ./bin/generate-version-file.js
git log -n 1 --no-color --pretty='%s' > ./commit-summary.txt
git log -n 1 --no-color --pretty=medium > ./commit-description.txt