Build images without pushing
In Harness CI, you can build images without pushing them. For example, you can use your CI pipeline to test a Dockerfile from your codebase to verify that the resulting image is correct before you push it to your Docker repository.
The build dry run configuration depends on your build infrastructure and the step or plugin you use for your build.
Harness Cloud, local runner, or self-managed VM
Use these instructions for build dry runs on Harness Cloud, self-managed VM, or local runner build infrastructure.
- Built-in Build and Push steps
- Run step
For built-in Build and Push steps, you need to add a stage variable named PLUGIN_DRY_RUN
.
- In your CI pipeline, go to the Build stage that includes a Build and Push step.
- In the Build stage's Overview tab, expand the Advanced section.
- Select Add Variable and enter the following:
- Name:
PLUGIN_DRY_RUN
- Type: String
- Value:
true
- Name:
- Save and run the pipeline.
For build scripts executed in Run steps, refer to your build tool's documentation for dry run specifications.
Kubernetes cluster build infrastructure
Use these instructions for build dry runs on Kubernetes cluster build infrastructure.
- Built-in Build and Push steps
- Buildah plugin (Plugin step)
- Run step
For the built-in Build and Push steps, add the PLUGIN_NO_PUSH
variable to the Build and Push step's Environment Variables.
envVariables:
PLUGIN_NO_PUSH: true
The Buildah plugin is used to build and push with non-root users.
To configure a build dry run with this plugin, add the following stage variable to the stage where you run the Buildah plugin:
variables:
- name: PLUGIN_DRY_RUN
type: String
description: ""
required: false
value: "true"
For build scripts executed in Run steps, refer to your build tool's documentation for dry run specifications.