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
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
- Go to your Cloud Platform Console Credentials page
- Select the project that you’re creating credentials for.
- To set up a new service account, click Create credentials and then select Service account key.
- Choose the service account to use for the key.
- 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:
- Create a Service Account in GCP to use with Codefresh, if you have not created it yet.
- Grant the created SA with proper privileges to access GCR across different projects.
- Create a key for the SA
- Use the created key to check login to GCR like this:
docker login -u _json_key -p "$(cat keyfile.json)" https://gcr.io
- Integrate the GCR with Codefresh using the Other registries option:
- Registry name:
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>