Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Share artifacts between "plans"

Deleted user July 29, 2011

I have a plan that generates a key file. This plan takes about 2hr to run and the output is used by lots of other plans.

What's the best way to share an artifact with other plans, without having to run the lengthy job in each plan?

Thanks!

2 answers

1 accepted

0 votes
Answer accepted
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 1, 2011

The easiest way would be to structure your plan in the following way:

Stage 1:

- Job that generates the key file, defined as a shared artifact

Stage 2:

- Job 1 that uses the artifact from Stage 1

- Job 2 that uses the artifact from Stage 1

...

- Job X that uses the artifact from Stage 1

If you cannot define it that way (i.e. you need each plan to be a separate Plan), you should structure it in the following way:

Plan 1

- Job that generates the key file, defined as an artifact

Plan 2, depending on the Plan 1:

- Job 1

Plan 3, depending on the Plan 1:

- Job 1

...

Plan X, depending on the Plan 1:

- Job 1

And in each job, you should have a task that downloads the key file from Plan 1 (use Bamboo's REST API to find out the URL for your key file, or just point to the 'latest' build).

Matt Fair October 14, 2011

Przemek,

What's the best way to get a list of artifact links via the REST API? Looking at the documentation I have not had success getting this, especially in a JSON or XML format. The closest I got was:

  1. Using the REST API to get the PROJECTKEY-PLANKEY-BUILDNUMBER key with /rest/api/latest/result/PROJECTKEY-PLANKEY-STAGEKEY/latest.json?expand=results.result.artifacts
  2. query /browse/PROJECTKEY-PLANKEY-BUILDNUMBER/artifact/STAGEKEY/JOB which returns an HTML page of artifacts that I would need to parse to get the links.

Is there a better way? Is there a way to get the MD5 checksum to validate data transfer via the API?

Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2011

What are you missing when you use the REST call? it should give you the URL.

Regarding MD5s: you can calculate the md5 in a script task into a file and just publish the sums as artifacts.

BTW. In your examples, it's not STAGEKEY but JOBKEY.

Matt Fair October 16, 2011

With ?expand=results.result.artifacts all I get back is:

<artifacts size="2" max-result="2" start-index="0"/>

I would have thought that the expand argument would have filled in artifact elements inside of artifacts. I'm using 2.3 rc3, has something changed with the API?

As for the MD5, storing it as an artifact makes sense. (i.e. filename.md5)

Matt Fair October 17, 2011

Using latest.json?expand=artifact will expand the artifacts section. For each artifact it provides name, link, producer job key, shared (true/false), size, and pretty size description. My artifact was a directory that contains files inside it. So the link for my artifact just brings me back to /browse/PROJECTKEY-PLANKEY-BUILDNUMBER/artifact/JOBKEY/JOB/ARTIFACT which provides a list of files in my artifact, but it is an HTML file. I can parse the HTML, but it is a hack and would be cleaner if a JSON or XML file is available. Is this possible? Or is only the HTML available to read the contents of an artifact?

Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 17, 2011

Yeah, it's HTML-only - sorry.

0 votes
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2011

What if you try expand=artifacts ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events