There's a hacky workaroud for this. Instead of artifacts you use a custom cache. You have to clear it before each use to keep it fresh and then use it in subsequent pipeline steps, where needed.
You have to create a custom cache and a step to clear it:
definitions:
caches:
artifact-cache: node_modules
step: &clear_artifact_cache
name: clear_artifact_cache
script:
- pipe: atlassian/bitbucket-clear-cache:3.1.1
variables:
BITBUCKET_USERNAME: $CLEAR_CACHE_USERNAME
BITBUCKET_APP_PASSWORD: $CLEAR_CACHE_PASSWORD
CACHES: ["artifact-cache"]
You need to define username and password env variables in your repository settings.
Then you have to:
- Turn on the cache for a pipeline step that generates your artifacts
- Call clear_artifact_cache step before the step that generates artifacts
- Turn on artifact-cache for all the following steps that need to use your generated artifacts
Example:
definitions:
step: &yarn_install
name: yarn_install
image: mycustom:nodejs14
caches:
- artifact-cache
script:
- yarn
pipelines:
custom:
my-custom-pipeline:
- step: *clear_artifact_cache
- step: *yarn_install
- step: *build_from_artifacts
Sometimes I feel like Bitbucket lacks of a project owner. This is a great feature, but with a little more thought it could be perfect:
artifacts: download: - "artifact-only-relevant-for-this-step.txt"