Docker Build & Push

Builds a container image and optionally pushes it to a registry using Docker. This module uses the Docker Buildx plugin to enable advanced build scenarios, and automatically authenticates with a Docker registry.

Object Representation (YAML)

id: String
name: String
type: String
depends: [String]
tags: [String]
condition: Boolean
each: Array
verbosity: String
ignore_errors: Boolean
properties:
  credential: String
  tags: [String]
  context_path: String
  dockerfile_path: String
  dockerfile_content: String
  load: Boolean
  push: Boolean
  pull: Boolean
  network: String
  target: String
  build_args:
    - name: String
      value: String
  labels:
    - name: String
      value: String
  outputs:
    - name: String
      value: String
  registry_url: String
  allow: [String]
  cwd: String
  args: String
  env:
    - name: String
      value: String

Fields

PropertyDetails
id *

String

A unique identifier for the step.

Can contain hyphens and underscores, but not spaces.

name *

String

A friendly name for the step. This name will appear in the pipeline designer and run output.

type *

String

The type of the step. Can be pipeline or a step module type.

depends[]

[String]

A list of dependencies of this step.

This step will not be executed until all steps with ids in this list are finished executing.

tags[]

[String]

Tags are used to group related steps. Steps with the same tag can be retrieved using the findStepsByTag() helper function.

Can contain hyphens and underscores, but not spaces.

condition

Boolean

An expression which is evaluated before the step executes. If it evaluates to false, the step will be skipped. The step.result.status field will be "Skipped".

each

Array

An array of elements to execute the step once for each of them.

verbosity

String

Step event verbosity. Determines how much information about step execution is sent back to the application.

ignore_errors

Boolean

If true, errors in the step module will not halt pipeline execution, and subsequent steps will still be executed. The step.result.status field will be "Failed" if the step encounters an error.

properties.credential

String

The ID of a Username/Password credential. This credential is used to log in to a container registry, and is optional if push is not true.

properties.tags[] *

[String]

A list of image tags. At least one tag is required.

properties.context_path

String

Path to the build context. Defaults to the current directory.

properties.dockerfile_path

String

Specify an explicit path to a Dockerfile. Defaults to ./Dockerfile.

properties.dockerfile_content

String

Provide Dockerfile content inline. This will be written to a file and used as the Dockerfile for the build.

properties.load

Boolean

Load the image into the local Docker daemon. Cannot be provided if push is true.

properties.push

Boolean

Push the image to a registry. Cannot be provided if load is true.

properties.pull

Boolean

Always pull the latest image version.

properties.network

String

The networking mode to use for the build, such as host or overlay.

properties.target

String

The target build stage.

properties.build_args[]

[Object]

A list of build arguments to provide to docker buildx.

properties.build_args[].name *

String

Build argument name.

properties.build_args[].value *

String

Build argument value.

properties.labels[]

[Object]

A list of metadata labels to assign to the image.

properties.labels[].name *

String

Label name.

properties.labels[].value *

String

Label value.

properties.outputs[]

[Object]

A list of output destinations, such as type=docker. See the docker buildx documentation for more information.

properties.outputs[].name *

String

Output destination name.

properties.outputs[].value *

String

Output destination value.

properties.registry_url

String

Registry URL.

properties.allow[]

[String]

Allow Privileged Entitlements.

properties.cwd

String

Change directories before running docker buildx.

properties.args

String

Extra command line arguments to pass to docker buildx.

properties.env[]

[Object]

A list of environment variables that will be set for script execution.

properties.env[].name *

String

Environment variable name.

properties.env[].value *

String

Environment variable value.

Result Fields

The following are the step execution result fields available at steps.<step id>.result after a step executes.

KeyDetails
result.status

String

A string indicating the step execution status. Can be Succeeded, Failed, or Skipped.

result.exit_code

Number

Exit code of the script process.

result.stdout

String

Stdout of the script process.

result.stderr

String

Stderr of the script process.

result.image_id

String

The full ID of the built image. Also called a "digest".