It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to access a shared artifact from a subsequent stage

Hi there, this problem has taken up far too much of my time for something which should be trivial. The documentation does not help in showing how an artifact is accessed, only how to define it as shared and how to set a shared artifact as a dependency.

I have two stages, stage one generates an artifact

Stage two has a script task that requires this artifact

The documentation ( is pretty clear in saying that when creating the dependency on an artifact in a subsequent stage, the dependent artifact will be put in a destination directory relative to the build directory. I assume this means that it will be copied or linked to Stage 2's build directory in an arbitrary target directory.

So I naively tried to access it in Stage 2 by using


But this does not work. Does 'target' have to exist? I do not do a source code check out in Stage 2, so the build directory is theoretically empty. There are no errors, nothing to indicate I have done anything incorrectly.

I continued hunting around and found the Produced Artifacts page that just confused me even more. In Stage 1 it states that the shared artifacts are in:


Looking at the global bamboo variables that I have access to, there doesn't seem to be any obvious variable I can use to access this, so I have to construct it somehow.

What am I doing wrong here?

1 answer

0 votes

Does 'target' have to exist?



But this does not work.

If you use target/artifact_name instead, does it work? Did you specify a Working Sub Directory for your script task?

Ok, I removed the destination directory, 'target'. And changed the way I access the artifact to be:


It still can not find the file.

I also print out the current working directory in my script and it is equal to ${}, so I do not think there would be any difference in changing it from the absolute path ${}/artifact_name to a relative path artifact_name.

I will try it anyway.

Hmm. Just thought of something. My artifact is a directory, it has 2 sub dirs and a bunch of files in each sub dir.

Could it be that the parent directory (artifact_name) isn't actually there, and its only the 2 sub dirs? I dont have access to the server's filesystem to check, but I will change the script to do a directory listing and print out what is available.

I will report back with the results when it finishes

Ok that was the problem. The artifact definition is */** (i.e. the contents) of the parent directory, and I assumed the parent directory was the artifact.


Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Apr 09, 2019 in Portfolio for Jira

Portfolio for Jira 3.0 is here!

The wait is over... Portfolio for Jira Server and Data Center 3.0 is now officially here! Platform releases offer Atlassian an opportunity to shift our strategy, make bold predictions about t...

1,303 views 13 25
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you