Add Google Artifact Registry as a Docker Registry

Google is trying to migrate customers from Container Registry(GCR) to the Artifact Registry(GAR). Currently, Harness does not support GAR natively as an Artifact Source Provider. We can get Harness to use GAR as a Docker Registry, with a few simple steps.

To get this to work, you will need

  1. An Artifact Registry repo in the Google Cloud Platform (GCP). Quick start instructions for setup Docker with an Artifactory Registry can be found at Quickstart for Docker  |  Artifact Registry documentation  |  Google Cloud
  2. To have setup a Service Account in GCP. Setting up authentication can be found at Setting up authentication for Docker  |  Artifact Registry documentation

After you have adding an Image in GAR. It will look something like this,

If you have setup a JSON key it will look something like this,

From the CLI, (I am using BASH) you will need to convert the content to bash64

base64 -i inputfile -o outputfile

Go to the Harness Secret Manager, and add a new Encrypted Text Secret. Copy the content from the outputfile and paste it into the value field.

Screen Shot 2021-02-03 at 4.16.59 PM

Go to the Artifact Servers Page and lets create a new Docker registry. Harness

  1. The Docker Registry URL should be the location of the Repo from the Artifact Registry that was setup.
  2. The username does not matter.
  3. The password should be the one that you have just save to the Secrets Manager.

Screen Shot 2021-02-03 at 4.20.19 PM

If you test this, and the credentials and the Registry URL are all valid, it will pass.


Next setup your Artifact Source in a Service,

  1. The Source Server should match the Artifact Service Provider that you just setup above.
  2. The Docker Image Name should match the path to the Image from the GAR that you had setup.
  3. Click Submit and it will be saved.

Screen Shot 2021-02-03 at 4.24.13 PM

In the Service Page Click on Artifact History and you should be able to verify the complete setup by Manually Select An Artifact.

The Artifact should be populated with the Tag from when you originally setup the GAR. (The first screenshot shows the quickstart-image with a tag of tag1.

Screen Shot 2021-02-03 at 4.28.38 PM

That is everything that you need to do to setup a GAR as a Docker Registry in Harness.

1 Like