Migrating from the Codefresh registry to Google Container Registry

Migrating from the Codefresh registry to Google Container Registry

5 min read

On July 15th the Codefresh registry that is part of all Codefresh accounts will be removed from service. The removal is part of a big round of improvements to our native integration with Docker registries. We have invested significant efforts in using Codefresh as a unified platform for Docker images and the way they are used inside CI/CD pipelines.

More details on the migration actions for the Codefresh registry can be found in our timeline announcement. The benefits of the new Docker build steps and other enhancements are also described in our roadmap blog post.

The new build enhancements are live right now in all Codefresh accounts, along with our migration dashboard that helps all customers select their new default Docker Registry as well as enabling all the other advancements.

How the migration affects Codefresh and GCR customers.

Your user experience after the migration takes place will not be changed significantly. In fact, the new Docker registry dashboard that is rolled along with all the enhancements will actually improve the usage and visibility of Docker images inside pipelines. Docker images from external registries will now be visible inside the Codefresh Image dashboard allowing you to inspect all build artifacts from a central place.

If you are already using the Google Container Registry in Codefresh, the migration is straightforward as you can simply mark GCR as your new default registry (more technical details are explained in the next sections of this article).

If you are not using Google Container Registry yet, you can connect it today to your Codefresh account via your Codefresh account settings (either with native integration or using it as a generic Docker registry).

The benefits of using GCR with Codefresh

The Google Container Registry (GCR) is part of the Google Cloud platform and offers a reliable and available storage service for Docker images.

The usage of GCR is especially important if you are already using other Google Cloud services or deploy to the Google Kubernetes Services, as there are several speed benefits when your Docker images are close to the services that use them. Of course you can even use the Google Container Registry for development of Docker images that you use in your pipelines for CI/CD purposes regardless of where your applications are deployed.

Using GCR also comes with extra benefits such as:

Connecting your GCR registry to Codefresh

Codefresh has native support for connecting to the GCR service. First, you need to create a service account in the form of a JSON file. Then visit the integration dashboard at https://g.codefresh.io/account-admin/account-conf/integration/registry and enter the details in the fields provided. Note that you have to be a Codefresh administrator to access this screen.

Google Registry integration
Google Registry integration

The authentication settings are defined once in the account level and then all pipelines can easily access this registry by using its name (“gcr” in the example) above, so make sure that you note that name down (and provide it to the developer team if you are a Codefresh admin).

If you have more than one registry you can repeat the process by changing the domain dashboard. Each registry must also have a unique name within your Codefresh account.

Migrating new images to GCR

Once the Google Registry is connected all your pipelines can use it to push new images to it. There are the two scenarios we will explain:
When you use the old build step and old image dashboard
When you use the new build step and new image dashboard (recommended)

You can toggle the new build step and image dashboard at: https://g.codefresh.io/account-admin/account-conf/cfcr-deprecation

Migration dashboard
Migration dashboard

Once you do this, all your build steps can simply mention the Google Container registry.

version: "1.0"
stages:
  - "clone"
  - "build"
steps:
  clone:
    title: "Cloning repository"
    type: "git-clone"
    repo: "codefresh-contrib/helm-sample-app"
    revision: "master"
    stage: "clone"

  build_image:
    title: "Building Docker image"
    type: "build"
    image_name: "my-go-app"
    working_directory: "${{clone}}"
    tag: "latest"
    dockerfile: "Dockerfile"
    registry: gcr
    stage: "build"

Notice the “registry” property in the build_image step. This means that the pipeline will automatically push to the GCR the image that was just built. You can inspect your new image on the Image dashboard (at https://g.codefresh.io/images/ ). The “registry” property is optional if the GCR registry is already set as default in your Codefresh account.

Docker image dashboard
Docker image dashboard

If you haven’t enabled the new build step yet, you can use the same property in the push step of a pipeline:

version: "1.0"
stages:
  - "clone"
  - "build"
  - "push"
steps:
  clone:
    title: "Cloning repository"
    type: "git-clone"
    repo: "codefresh-contrib/helm-sample-app"
    revision: "master"
    stage: "clone"

  build_image:
    title: "Building Docker image"
    type: "build"
    image_name: "my-go-app"
    working_directory: "${{clone}}"
    tag: "latest"
    dockerfile: "Dockerfile"
    stage: "build"

 push_image
  type: push
  stage: push
  arguments:
    candidate: build_image:
    tag: latest
    image_name: my-go-app
    registry: gcr

Again notice the “registry” property in the push step.

You can find more documentation of the build and push steps at:

Migrating existing images to GCR

In the previous section, we have seen how you can modify your pipeline so that they can use the Google Registry for image pushing. However, you might also have existing Docker images in your Codefresh registry with no associated pipelines (or even images that you manually uploaded to the registry outside of Codefresh).

In this case, you can easily create a brand new pipeline that promotes the images from the Codefresh registry to GCR.

 promote_to_production_registry:
    title: Promoting to GCR 
    type: push
    candidate: r.cfcr.io/kostis-codefresh/my-app-image:master
    tag: '2.0.3’'
    registry: gcr

You can also use multiple tags if you wish:

 promote_to_production_registry:
    title: Promoting to GCR 
    type: push
    candidate: r.cfcr.io/kostis-codefresh/my-app-image:master
    tags:
    - '2.0.3’'
    - latest
    - prod
    registry: gcr

You only need to run this pipeline once. For one-off migrations, you can also use the Codefresh UI to promote an image to GCR.

Contact information

Migrating your Codefresh images to the Google Container Registry is a very easy process, especially if all your Docker images were created by Codefresh pipelines. If you already use GCR before the migration the process might be even simpler, as you only need to make sure that no forgotten images exist in the Codefresh registry (as all pipelines will push new images to GCR).

If you have more question for the migration timeline feel free to reach us at [email protected]

For more information on GCR and its unique features please visit its documentation.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Ready to Get Started?
  • safer deployments
  • More frequent deployments
  • resilient deployments