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
How to Run Steps in Parallel in Bitbucket PipelinesRun independent Bitbucket Pipelines steps at the same time with a parallel block, cutting wall-clock time for…
How to Cache Dependencies in Bitbucket PipelinesCache dependencies in Bitbucket Pipelines with the caches key, reusing the built-in node cache or defining a…