Push step

Pushing Docker images from your pipeline

If you use the Codefresh Docker Registry this step is optional as all successful Codefresh pipelines automatically push the Docker image they create in the integrated Codefresh registry. No further configuration is needed to achieve this behavior.

Push a built image to a remote Docker registry with one or more tags. Supports standard Docker registries and ECR.

Using Docker registry integration in Codefresh pipelines

Notice that when you use any external registry, your Codefresh username should match your account at that registry, otherwise the build step will fail. For example if your Codefresh image is tagged as foo_username/my_image but your Dockerhub account is bar_username then the build will fail and you need to customize the push step to use bar_username instead.

YAML

step_name:
  type: push
  title: Step Title
  description: Free text description
  candidate: ${{build_step_name}}
  tag: latest
  image_name: codefresh/app
  registry: my-registry
  fail_fast: false
  when:
    branch:
      only: 
        - /FB-/i
  on_success:
    ...
  on_fail:
    ...
  on_finish:
    ...
  retry:
    ...  
Field Description Required/Optional/Default
title The free-text display name of the step. Optional
description A basic, free-text description of the step. Optional
stage Parent group of this step. See using stages for more information. Optional
candidate The identifier of the image to push to the remote Docker registry. It can be an explicit identifier of an image to push, or a variable that references a Build step. Required
tag The tag under which to push the image. Use either this or tags.
The default is latest.
Default
tags Multiple tags under which to push the image. Use either this or tag. This is an array, so should be of the following style:
tags:
- tag1
- tag2
- ${CF_BRANCH}
- tag4
or
tags: [ 'tag1', 'tag2', '${CF_BRANCH}', 'tag4' ]
Default
image_name The tagged image name that will be used The default value will be the same image name as of the candidate. Default
registry The registry logical name of one of the inserted registries from the integration view.
The default value will be your default registry.
Default
fail_fast If a step fails, and the process is halted. The default value is true. Default
when Define a set of conditions which need to be satisfied in order to execute this step.
You can find more information in the Conditional Execution of Steps article.
Optional
on_success, on_fail and on_finish Define operations to perform upon step completion using a set of predefined Post-Step Operations. Optional
retry Define retry behavior as described in Retrying a step. Optional

Using passed credentials without pre-saving them

This option enables you to push your images without pre-saving the credentials in Codefresh’s registry integration view.

YAML

step_name:
  type: push
  title: Step Title
  description: Free text description
  candidate: ${{build_step_name}}
  tags: [ latest, ${{CF_BRANCH}} ]
  image_name: codefresh/app
  registry: dtr.host.com
  credentials:
    username: subject
    password: credentials
  fail_fast: false
  when:
    branch:
      only: 
        - /FB-/i
  on_success:
    ...
  on_fail:
    ...
  on_finish:
    ...
Field Description Required/Optional/Default
title The free-text display name of the step. Optional
description A basic, free-text description of the step. Optional
provider The type of Docker registry provider. Can currently be either docker for a standard Docker registry, or ecr for the Amazon EC2 Container Registry (ECR). Optional
Default value: docker
candidate The identifier of the image to push to the remote Docker registry. It can be an explicit identifier of an image to push, or a variable that references a Build step. Required
tag The tag under which to push the image. Use either this or tags.
The default is latest.
Default
tags Multiple tags under which to push the image. Use either this or ‘tag’.
This is an array, so should be of the following style:
tags:
- tag1
- tag2
- ${CF_BRANCH}
- tag4
or
tags: [ 'tag1', 'tag2', '${CF_BRANCH}', 'tag4' ]
Default
image_name The tagged image name that will be used. The default value will be the same image name as of the candidate. Default
registry The host address where the registry is located.The default is the registry configured in your Codefresh account, or Dockerhub. Default
Ignored when provider is ecr
credentials Credentials to access the registry if it requires authentication. It can be a has object containing username and password fields. The default is the credentials configured in your Codefresh account. Optional
Ignored when provider is ecr
accessKeyId Your AWS access key. Optional
Ignored when provider is docker
secretAccessKey Your AWS secret access key. Optional
Ignored when provider is docker
region The region where the ECR registry is accessible. Optional
Ignored when provider is docker
fail_fast If a step fails, and the process is halted. The default value is true. Default
when Define a set of conditions which need to be satisfied in order to execute this step.
You can find more information in the Conditional Execution of Steps article.
Optional
on_success, on_fail and on_finish Define operations to perform upon step completion using a set of predefined Post-Step Operations. Optional

Exported resources:

  • Image ID.