feat(artifact-registry): push to public GAR when public registry is available
Part of uis/devops/infra/terraform/ucam-faas#13 (closed)
Description
This MR adds two jobs to the artifact-registry.yml
file:
artifact-registry-push-public
artifact-registry-push-public-dev
These jobs will automatically be available when PUBLIC_ARTIFACT_REGISTRY_DOCKER_REPOSITORY
is set on the repository (which is only the case when a public artifact registry is set up for that project).
Why?
We already have a couple of places where we do this manually:
- https://gitlab.developers.cam.ac.uk/uis/devops/infra/gke-load-balancer-healthcheck/-/blob/main/.gitlab/webapp.gitlab-ci.yml#L54
- https://gitlab.developers.cam.ac.uk/uis/devops/ucam-observe/ucam-observe-remote-server/-/blob/main/.gitlab-ci.yml#L9
And I was about to add a third one to push the ucam-faas-python docker images to the shared-code public registry, so I figured it was actually better to move this to the CI templates.
I also had to make some additional changes so that the multi stage docker build also supports pushing to the public registry, which I believe made the code a little bit cleaner.