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 https://cloud.google.com/artifact-registry/docs/docker/quickstart
-
To set up a Service Account in GCP. The instructions can be found at https://cloud.google.com/artifact-registry/docs/docker/authentication#json-key
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 letβs create a new Docker registry.
- The Docker Registry URL should be the location of the Repo from the Artifact Registry that was set up.
- For Authentication using a Service Account Key, the username is required and has two values
ββ_json_key
or
_json_key_base64
- The username should match the key type. In the example below _json_key_base64
- The password should be the one that you have just saved 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 set up above.
- The Docker Image Name should match the path to the Image from the GAR that you had set up.
- Click Submit and it will be saved.
In the Service Page Click on Artifact History and you should be able to verify the complete the set up by Manually Select An Artifact.
The Artifact should be populated with the Tag from when you originally set up the GAR. (The first screenshot shows the quickstart-image with a tag of tag1.
That is everything that you need to set up GAR as a Docker Registry in Harness.