Collection of reusable GitHub Actions workflows:
Sets up docker and builds a container from Dockerfile
in the calling repository.
The workflow authenticates to Google Container Registry through Workload Identity Federation. The calling repository needs to be given access to use workload identity. Ask #team-platform about this.
The workflow generates the following tags on the built container image:
latest
if the event was a push to the default branch of the repository.commit-sha
(short) on push.vx.y.z
for releases with semver tag.
name: Docker Build, Push & Deploy
on:
release:
types: [published]
push:
branches: ['main']
jobs:
build:
uses: atb-as/workflows/.github/workflows/cluster-docker-build-tag-push.yaml@v2
with:
image: gcr.io/atb-mobility-platform/foo
secrets:
github_pat: ${{ secrets.GH_PAT }}
- Create PR
- Get approval
- Merge into main branch
- The docker image is built and tagged
- The docker image is pushed to GCR
- The docker image is deployed to staging
- Create a GitHub release with a tag
- The docker image is built and tagged (skipped if it exists)
- The docker image is pushed to GCR (skipped if it exists)
- The docker image is deployed to production
Only do this if there are changes in main that cannot be deployed to production.
- Checkout the tag and create a new branch
- Make the hotfix and push the branch
- Create a new release from the branch
- The docker image is built and tagged (skipped if it exists)
- The docker image is pushed to GCR (skipped if it exists)
- The docker image is deployed to production
It's preferable to do this as a PR in the cluster-infra
repo. Do a revert of the commit that deployed the release you want to roll back and create a PR with the reverted commit.
Sets up docker and builds a container from Dockerfile
in the calling repository.
The workflow authenticates to Google Container Registry through Workload Identity Federation. The calling repository needs to be given access to use workload identity. Ask #team-platform about this.
The workflow generates the following tags on the built container image:
latest
if the event was a push to the default branch of the repository.commit-sha
(short) on push.vx.y.z
for push events with semver tag.
name: Docker Build & Push
on:
push:
tags:
- v*
branches:
- main
jobs:
build:
uses: atb-as/workflows/.github/workflows/docker-build-push.yaml@main
with:
image: gcr.io/atb-mobility-platform/foo
build_args: |
FOO=BAR
secrets: |
PASSWORD=shh