Buildkite Certification

Learn · Artifacts

Downloading them again

Uploading is only half of it. A later step still starts with an empty working directory, so it has to ask for what it needs:

steps:
  - key: build
    command: make dist
    artifact_paths: "dist/*.tar.gz"

  - depends_on: build
    command: |
      buildkite-agent artifact download "dist/*.tar.gz" .
      make publish

buildkite-agent artifact download takes a glob and a destination directory. The downloaded files land relative to that destination.

By default it looks at artifacts from the current build. You can narrow it to a specific step with --step, which matters when several steps upload files with overlapping names:

buildkite-agent artifact download "dist/*.tar.gz" . --step build

Artifacts or meta-data?

Both move information between jobs, and choosing wrongly is a common source of slow builds.

Meta-data is for small values — a version string, a commit SHA, a decision. Reading it is a fast API call.

Artifacts are for files. Every download is a transfer, and a step that pulls a large artifact it does not need has just added that transfer to your critical path.

If what you are passing would fit in an environment variable, it should probably be meta-data.

Check

Write a pipeline with two command steps. The first, keyed `build`, runs `make dist` and uploads artifacts matching `dist/*.tar.gz`. The second depends on `build` and downloads those artifacts with `buildkite-agent artifact download` before running `make publish`.

Sign in to answer and record your progress.