Using artifacts in steps

Artifacts are files that are produced by a step. You can choose to keep the artifacts after a step completes and share them with a following step. For example, you may wish to keep reports or JAR files generated by a build step and share them with a later deployment step. 

There are some things to remember:

  • Files that are in the BITBUCKET_CLONE_DIR at the end of a step can be configured as artifacts. The BITBUCKET_CLONE_DIR is the directory in which the repository was initially cloned.
  • You can use glob patterns to define artifacts. Glob patterns that start with a * will need to be put in quotes.
  • Artifact paths are relative to the BITBUCKET_CLONE_DIR.
  • Artifacts that are created in a step are available to all the following steps.
  • Once a pipeline completes, whether it succeeds or fails, the artifacts are deleted.


In the example bitbucket-pipelines.yml file that follows, we show how to configure artifacts to share them between steps.

  • When the script for 'Build and test' completes, all files under the dist folder in the BITBUCKET_CLONE_DIR are kept as an artifact.
  • 'Integration test' and 'Deploy to beanstalk' can access files in dist.
  • Any changes to dist by 'Integration test' will not be available in 'Deploy to beanstalk' unless dist/** is specified as an artifact in 'Integration test'.

    - step:
        name: Build and test
        image: node:8.5.0
          - node
          - npm install
          - npm test
          - npm run build
          - dist/**
    - step:
        name: Integration test
        image: node:8.5.0
          - node
          - postgres
          - npm run integration-test
    - step:
        name: Deploy to beanstalk
        image: python:3.5.1
          - python

      image: postgres:9.6.4



Manual steps and artifact expiry

Manual steps will have build artifacts produced by any previous steps copied into their working directory, similar to automatic steps.

Artifacts are stored for 7 days following the execution of the step that produced them. After this time, the artifacts are expired and any manual steps later in the pipeline can no longer be executed.

If you need artifact storage for longer than 7 days (or more than 1 GB), we recommend using your own storage solution, like Amazon S3 or a hosted artifact repository like JFrog Artifactory. Setting a reasonable time limit for build artifacts allows us to manage our costs so we don't have to charge for storage and transfer costs of build artifacts in Pipelines.


See these pages for more information:

Last modified on Nov 8, 2017

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.