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 on Configuring jobs.
  2. Click the Artifacts tab, and then Create definition:
    1. Specify a Name for the artifact.
    2. Use Location to specify the folder, relative to the build directory, where the artifact will be located. Do not use the absolute path to the artifact. Wild cards are not supported.
    3. Copy pattern is 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. Select the Shared check box if you want to share artifacts with other jobs in the plan.
  3. Click 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 on Configuring jobs, and click the Artifacts tab (see Configuring a job's build artifacts).
  2. Either click 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 click the Artifacts tab. 

  4. Click Create dependency, then:

    • Choose from the Artifact list.

    • Specify the Destination directory, then click Create.

       

 

 

  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 Configure plan from the 'Actions' drop down menu.
    2. Click on Stages & jobs and select a job or create a new job if one does not already exist.
    3. Click on the Tasks tab for the selected job.
  2. 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:

    FieldDescriptionOptional?
    Task descriptionA brief description of the artifact downloader task(tick)
    Disable this taskCheck this box to disable the task-
    Source PlanThe build plan that is the source of the artifact you need to download(error)
  3. 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
  4. Click on Save to save your artifact download configuration.
  1. 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.
  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 and expand the relevant environment panel. In the Other settings section, click on the Tasks button. The 'Set up tasks' screen will display:


  2. 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:

    FieldDescriptionOptional?
    Task descriptionA brief description of the artifact downloader task.(tick)
    Disable this taskCheck this box to disable the task.-
    Artifact NameUse the drop down 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. Click Add another artifact to add another artifact to the download list. 
  4. Click Save to save your artifact download configuration.

 

  1. 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.
  2. Destination directory is relative to the build directory. Do not use the absolute path to refer to the destination directory.
Last modified on Nov 23, 2020

Was this helpful?

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