This page describes how to share artifacts. Bamboo allows artifact sharing between:
- Jobs
- Build plans
- Build plans to deployment environments.
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:
- Navigate to the configuration pages for the job that will produce the artifact, as described on Configuring jobs, and click the Artifacts tab (see Configuring a job's build artifacts).
- Click Edit for the artifact that you want to share. The artifact definition will be displayed.
- Select the Shared check box and then click Save.
Navigate to the job in a subsequent stage that will consume the artifact, and click the Artifacts tab. Click Create Dependency. Complete the fields on the screen (see screenshot below) and click Create.
On this page:
Atlassian Blogs:
- 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.
- Destination directory is relative to the build directory. Do not use the absolute path to refer to the destination directory.
Screenshot: Creating an artifact dependency
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:
- Locate the build plan that you wish to associate an artifact with.
- Select Configure plan from the 'Actions' drop down menu. The plan configuration window will display
- Click on Stages & jobs and select a job or create a new job if one does not already exist
- Click on the Tasks tab for the selected job. The 'Tasks' pane will appear
Click the Add task button. The 'Task types' window will appear. Select Artifact Downloader Task to open the 'Artifact downloader task' configuration pane:
Complete the configuration using the following options:Field Description Optional? Task description A brief description of the artifact downloader task Disable this task Check this box to disable the task - Source Plan The build plan that is the source of the artifact you need to download - Click on Add another artifact to add another artifact to the download list. Alternatively, use the grey cross icon to delete an artifact from your configuration
- Click on Save to save your artifact download configuration.
- The Artifact drop down 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
- Destination directory is relative to the build directory. Do not use the absolute path to refer to the destination director
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:
- Open your deployment project and expand the relevant environment panel. In the Other settings section, click on the Tasks button. The 'Set up tasks' screen will display:
Click Add task. The 'Task type' selection window will display. Select Artifact Downloader Task to open the 'Artifact downloader task configuration' pane:
Complete the configuration using the following options:Field Description Optional? Task description A brief description of the artifact downloader task Disable this task Check this box to disable the task - Artifact Name Use the drop down menu to locate the name of the artifact that you want to download Destination Path The location of the working directory into which you want the artifact downloaded - Click Add another artifact to add another artifact to the download list.
- Click Save to save your artifact download configuration.
- The Artifact drop down 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
- Destination directory is relative to the build directory. Do not use the absolute path to refer to the destination director





6 Comments
Anonymous
Nov 13, 2013So when sharing artifacts between plans thru the Artifact Download task, does bamboo ensure that the artifact that's downloaded to the destination build comes from the last successful build of the origin plan.
NathanA
Nov 14, 2013Yes, that's right, it's taken from the latest successful build, or if it was triggered by a dependent build, then it will use artifacts from that dependency chain.
Lloyd Jones
Nov 21, 2013My question is if there is a bamboo variable available for the artifact name once its been downloaded in a deployment plan? We build war name from a series of variables, one of which is not available to the deployment plan (specifically the repo revision). We want to use this artifact in a command task but since we are not sure of the name we cannot.
James Dumay
Nov 21, 2013Hi Lloyd,
Unfortunastely there isn't a variable for the artifact name. However, there are variables for the repository revision that can be used from the deployment plan (bamboo.repository.revision.number). As a rule of thumb, any plan level variable should be available to the deployment project.
See the Bamboo variables reference for more details.
Thanks
James
Lloyd Jones
Nov 22, 2013Thanks James
I've found that its actually available as bamboo.planRepository.revision in a deployment plan.
Anonymous
Dec 17, 2013Boo. This would be very useful. Please add.