Skip to content
Latchkey

How to Pass Artifacts Between Steps in Bitbucket Pipelines

Bitbucket Pipelines hands files to later steps with the artifacts: keyword - the only way to share output across its isolated step containers.

List glob paths under a step's artifacts:. Bitbucket captures matching files and automatically makes them available to all subsequent steps in the same pipeline.

Produce and consume artifacts

The build step declares dist/** as artifacts; the deploy step downloads them automatically.

bitbucket-pipelines.yml
pipelines:
  default:
    - step:
        name: Build
        image: node:20
        script:
          - npm ci && npm run build
        artifacts:
          - dist/**
    - step:
        name: Deploy
        script:
          - ./deploy.sh dist/

Gotchas

  • Artifacts are passed downstream automatically to later steps - you do not "download" them explicitly.
  • Artifact paths are relative to $BITBUCKET_CLONE_DIR; absolute paths outside it are not captured.
  • Artifacts are kept for 14 days and capped in size - they are for handoff, not long-term storage.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →