Using Build Artifacts

In this guide we’ll walk through using the Buildkite Agent’s artifact support to store and retrieve files between different steps in a build pipeline.

Uploading Artifacts

By default the agent will upload any artifacts you’ve specified in your build step’s “Artifact Uploading” pattern:

Artifact pattern configuration

You can also upload your own artifacts from your build scripts using the buildkite-agent artifact command.

buildkite-agent artifact upload pkg/build.tar.gz

You can then download the artifact in subsequent build steps (even if the build step is running on a different build server).

For full documentation, and examples of supported glob patterns, see the buildkite-agent artifact upload documentation.

Downloading Artifacts

You can download artifacts created by a build job using the buildkite-agent artifact download command. For example:

buildkite-agent artifact download pkg/build.tar.gz pkg/

If an artifact was previously uploaded at pkg/build.tar.gz, the above command will download it to the pkg directory.

The buildkite-agent artifact command will find the last file uploaded with the matching filename, no matter which build step uploaded it. If you want to target an artifact from a particular build step use the --step argument. For example:

buildkite-agent artifact download build.zip tmp/ --step build

This will download the build.zip file from the pipeline step with the label "build".

For full documentation and examples, see the buildkite-agent artifact download documentation.

Downloading Artifacts Outside a Running Build

The buildkite-agent artifact download command only works within the context of a running build.

If you want to download an artifact from outside a build use our Artifact Download API.

Further documentation

See the Buildkite Agent artifact documentation for a full list of options and details of Buildkite’s artifact support.