Sharing artifacts

This page describes how to keep and share artifacts produced by a job, such as reports, websites or .jar files. Bamboo allows artifact sharing between:

Define an artifact to keep for a job

You can specify which artifacts to keep by setting up an artifact definition for the job. The artifacts will be available after each build of the job.

To set up a new artifact definition:

  1. Navigate to the job, as described in Configuring jobs.
  2. Select the Artifacts tab, and then Create definition:
    1. Specify a Name for the artifact.
      Names can contain only alphanumeric characters, underscores, dashes, and spaces.
    2. In Location, specify the folder relative to the build directory, where the artifact will be located. Don't use the absolute path to the artifact. Wildcards are not supported.
    3. In Copy pattern(s), specify the name (or Ant file copy pattern) of the artifact or artifacts you want to keep relative to Location. For example, if you want to keep the latest version of a .jar file, you could specify Copy pattern to be  */.jar and the Location to be target
    4. In Exclusion pattern(s), specify the name (or Ant file copy pattern) of the artifact or artifacts that you want to exclude. For example: **/*.jar.
    5. Select the Shared check box if you want to share artifacts with other jobs in the plan.
    6. Select the Required check box if you want to fail the build if the artifact cannot be published.
    7. Select the Compression check box if you want to compress the artifact when it's transferred between an agent and the server.
  3. Select Save.

Artifacts are copied to a subdirectory (/JOB_KEY/download-data/) under your Build Directory folder – see Locating important directories and files.


Sharing artifacts between jobs

You can share artifacts between jobs in different stages using artifact dependencies. For example, you may want to run acceptance tests on a build, sharing the same WAR from one job to another without rebuilding it each time.

Each time the artifact is shared with a subsequent job, it is copied to the job's agent.

To share an artifact between two jobs in different stages:

  1. Navigate to the configuration pages for the job that will produce the artifact, as described in Configuring jobs, and select the Artifacts tab (see Configuring a job's build artifacts).
  2. Either select Share for an existing artifact, or create a new artifact definition, as described above.
  3. Navigate to the job in a subsequent stage that will consume the artifact, and select the Artifacts tab. 

  4. Select Create dependency, then:

    • Select from the Artifact list.

    • Specify the Destination directory, then select Create.

      Create artifact dependency window 



  1. The Artifact list only shows artifacts from jobs in previous stages that have been marked as shared. This is described in Configuring a job's build artifacts.
  2. Destination directory is relative to the build directory. Do not use the absolute path to refer to the destination directory.
  3. The artifact from the most recent successful build will be used. If there are no successful builds from the artifact-producing plan or the artifacts have expired, the artifact-consuming job will fail.

Sharing artifacts between build plans

You can share artifacts between different build plans, however you need to use the Artifact downloader task to do so. For example, you may want to run acceptance tests on a particular build from a different plan by sharing the same WAR from one plan to another without rebuilding it each time.

To share an artifact between two build plans:

  1. Locate the build plan that you wish to associate an artifact with. 
    1. Select ActionsConfigure plan.
    2. Select Stages & jobs and select a job or create a new job if one does not already exist.
    3. Select the Tasks tab for the selected job.
  2. Select Add task > Artifact downloader.

     
    Complete the configuration using the following options:

    FieldDescriptionOptional?
    Task descriptionA brief description of the artifact downloader task.(tick)
    Disable this taskSelect this checkbox to disable the task.-
    Add condition to taskMake task run only when a certain condition is met. 
    You can find conditions on Atlassian Marketplace or implement your own.
    (tick)
    Source planThe build plan that is the source of the artifact you need to download.(error)
  3. Select Add another artifact to add another artifact to the download list. Alternatively, use the grey cross icon to delete an artifact from your configuration.
  4. Select Save.
  1. The Artifact dropdown menu only shows artifacts from jobs in previous stages that have been marked as shared. This is described in Configuring a job's build artifacts.
  2. Destination directory is relative to the build directory. Do not use the absolute path to refer to the destination directory.

Sharing artifacts from a build plan to a deployment environment

You can also share artifacts from a build plan into a deployment environment. For example, you may wish to share a particular build result from a plan with a deployment environment. To do this, you need to add the Artifact downloader task to a deployment environment during or after the environment creation process. 

To share an artifact from a build plan to a deployment environment:

  1. Open your deployment project. Expand the relevant environment panel, and select Edit tasks. Select Add task > Artifact download.
  2. Complete the configuration using the following options:

    FieldDescriptionOptional?
    Task descriptionA brief description of the artifact downloader task.(tick)
    Disable this taskSelect this checkbox to disable the task.-
    Add condition to taskMake task run only when a certain condition is met. 
    You can find conditions on Atlassian Marketplace or implement your own.
    (tick)
    Artifact nameUse the dropdown menu to locate the name of the artifact that you want to download.(error)
    Destination pathThe location of the working directory into which you want the artifact downloaded.(tick)
  3. Select Add another artifact to add another artifact to the download list. 
  4. Select Save.


  1. The Artifact dropdown menu only shows artifacts from jobs in previous stages that have been marked as shared. This is described in Configuring a job's build artifacts.
  2. Destination directory is relative to the build directory. Don't use the absolute path to refer to the destination directory.
Last modified on Nov 23, 2022

Was this helpful?

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