Skip to content
Latchkey

How to Pass Artifacts Between Steps in Bitbucket Pipelines

Steps run in separate containers, so files only carry forward through declared artifacts paths.

Declare artifacts: on the producing step with glob paths. Bitbucket uploads them and automatically restores them into every later step of the same pipeline.

Steps

  • Add artifacts: with one or more glob paths to the producing step.
  • Run the consuming step later in the same pipeline.
  • Reference the restored files directly; no download step is needed.

bitbucket-pipelines.yml

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

Gotchas

  • Artifact paths are relative to the clone directory and cannot point outside it.
  • Artifacts expire after 14 days and count toward storage; use caches for dependency trees instead.

Related guides

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