Run Step Settings

Updated 2 months ago by Michael Cretzman

This topic provides settings and permissions for the Harness CI Run step.

The Run step executes one or more commands on a container image.

In this topic:

Name

The unique name for this step.

ID

See Entity Identifier Reference.

Description

Text string.

Container Registry

The Harness Connector for a container registry. This is the container registry for the image Harness will use run build commands on, such as DockerHub.

Image

The FQN (fully-qualified name) of the Docker image to use when running build commands. For example: us.gcr.io/playground-123/quickstart-image.

The image name should include the tag and will default to the latest tag if unspecified. You can use any docker image from any docker registry, including docker images from private registries.

Different container registries require different name formats:

  • Docker Registry: enter the name of the artifact you want to deploy, such as library/tomcat. Wildcards are not supported.
  • GCR: enter the FQN (fully-qualified name) of the artifact you want to deploy. Images in repos need to reference a path, for example: us.gcr.io/playground-123/quickstart-image:latest.

  • ECR: enter the FQN (fully-qualified name) of the artifact you want to deploy. Images in repos need to reference a path, for example: 40000005317.dkr.ecr.us-east-1.amazonaws.com/todolist:0.2.

Commands

POSIX shell script executed inside the container. For example:

npm install 

npm test

The script is invoked as if it were the container’s entry point.

Privileged

Enable this option to run the container with escalated privileges. This is the equivalent of running a container with the Docker --privileged flag.

Report Paths

The path to the file(s) that store results in the JUnit XML format.

Regex is supported.

Environment Variables

Environment variables injected into the container and used in the Commands.

Output Variables

Output variables expose Environment Variables for use by other steps/stages of the Pipeline.

You reference the output variable of a step using the step ID and the name of the variable in Output Variables.

Let's look at a simple example.

In a step with the ID S1, in Command, export a new variable:

export myVar=varValue

In Output Variables, list the exported variable name:

In a later Run step, in Command, reference the output variable:

echo <+steps.S1.output.outputVariables.myVar>

Here's how the S1 step's output variable is referenced:

Syntax for referencing output variables between steps in the same stage:

<+[stepID].output.outputVariables.[varName]>

Syntax for referencing output variables between steps in different stages:

<+stages.[stageID].execution.steps.[stepID].output.outputVariables.[varName]>

The subsequent build job fails when exit 0 is present along with output variables.

Image Pull Policy

Select an option to set the pull policy for the image.

  • Always: the kubelet queries the container image registry to resolve the name to an image digest every time the kubelet launches a container. If the kubelet encounters an exact digest cached locally, it uses its cached image; otherwise, the kubelet downloads (pulls) the image with the resolved digest, and uses that image to launch the container.
  • If Not Present: the image is pulled only if it is not already present locally.
  • Never: the image is assumed to exist locally. No attempt is made to pull the image.

Shell

Select the Shell script.

Run as User

Set the value to specify the user id for all processes in the pod, running in containers. See Set the security context for a pod.

Set container resources

Maximum resources limit values for the resources used by the container at runtime.

Limit Memory

Maximum memory that the container can use.

You can express memory as an integer value with one of these suffixes: G, M, Gi, Mi.

Limit CPU

See Resource units in Kubernetes.

Limit the number of cores that the container can use.

Limits for CPU resources are measured in cpu units.

Fractional requests are allowed. The expression 0.1 is equivalent to the expression 100m, that can be read as one hundred millicpu.

Timeout

Timeout for the step. Once the timeout is reached, the step fails, and the Pipeline execution continues.

See Also


Please Provide Feedback