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

Aiman Alsari May 17, 2012

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 (http://confluence.atlassian.com/display/BAMBOO40/Configuring+artifact+sharing+between+jobs) 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

${bamboo.build.working.directory}/target/artifact_name

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:

$BAMBOO_HOME/data/artifacts/xxx-xxx/shared/build-yyyyy

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
Przemek Bruski Atlassian Team May 17, 2012

Does 'target' have to exist?

No.

${bamboo.build.working.directory}/target/artifact_name

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?

Aiman Alsari May 17, 2012

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

${bamboo.build.working.directory}/artifact_name

It still can not find the file.

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

I will try it anyway.

Aiman Alsari May 17, 2012

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

Aiman Alsari May 17, 2012

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.

Apologies

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 in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

858 views 12 14
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you