Google Container Registry

To configure GCR first select Google Container Registry from the new registry drop down and then provide the following

  • Registry Name - A unique name for this configuration
  • Key File - The contents of a JSON key file. See bellow for instructions

Add Google Container Registry

Generating a JSON key file

The JSON key file holds your credentials for a given Service Account. To generate your key file follow these instructions

  1. Go to your Cloud Platform Console Credentials page
  2. Select the project that you’re creating credentials for.
  3. To set up a new service account, click Create credentials and then select Service account key.
  4. Choose the service account to use for the key.
  5. Choose to download the service account’s public/private key as a JSON file.

You can find the complete guide here.

Working with multiple projects

If you have more than one repositories/projects in Google cloud, you have to configure a Google Service Account so that it can access all projects and then use it for the Codefresh integration.

Then you refer to the images according to the repository names, which correspond to the project names

Follow these steps:

  1. Create a Service Account in GCP to use with Codefresh, if you have not created it yet.
  2. Grant the created SA with proper privileges​ to access GCR ​across different projects​​.
  3. Create a key for the SA
  4. Use the created key to check login to GCR like this: ​docker login -u _json_key -p "$(cat keyfile.json)" https://gcr.io
  5. Integrate the GCR with Codefresh using​ the Other registries option​:
  • ​Registry name: <arbitrary_name>
  • ​Username: _json_key (literally)
  • Password: <contents_of_the_keyfile.json>
  • ​Domain: eu.gcr.io or us.gcr.io

Then you can refer to the registry​ like this in Codefresh YAML:

MyPushStep:
  title: pushing to Google Docker registry
  type: push
  candidate: <project_id>/<image_name>
  tag: <your_tag>
  registry: <registry_name_you_gave_in_step_5>