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
- 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
- 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.
Go to the Artifact Servers Page and lets create a new Docker registry. Harness
- The Docker Registry URL should be the location of the Repo from the Artifact Registry that was setup.
- The username does not matter.
- The password should be the one that you have just save to the Secrets Manager.
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,
- The Source Server should match the Artifact Service Provider that you just setup above.
- The Docker Image Name should match the path to the Image from the GAR that you had setup.
- Click Submit and it will be saved.
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.
That is everything that you need to do to setup a GAR as a Docker Registry in Harness.