When and how does Bamboo grab build artifacts ?

In order to minimize spaced used on my build agents I'd like to clean up artifacts produced during the build but preserve my working copy as checked out from Subversion. I would like for Bamboo to grab the artifacts I have configured, then run an additional clean task in the same working directory on the same agent. Any way to achieve this ?

2 answers

This widget could not be displayed.

If you look at the output of your build, you should see some of the order in which things are done. To wit:

simple	13-Dec-2011 10:12:47	Finished task 'Integration Tests'
simple	13-Dec-2011 10:12:47	Finished task 'Parse test results'
simple	13-Dec-2011 10:12:47	Running post build plugin 'Artifact Copier' <-- This grabs any shared artifacts
 
So based on this it would seem that indeed Artifact collection is done a bit too late in the build for you to be able to do anything to it in the Build Plan. As Przemek suggested, there is a Plugin out there that implements Post-build activities:
I believe this will fire after the Artifact Copier processor.
The rest of the solution will require a bit of work on your part. Just about every build tool I've used has the concept of build 'targets' and a target of 'clean' to reset the working directory back to a before-the-build state: make, ant, maven, rake, etc...

So :

Step 1 - Code up a 'clean' target into your build script. Test that it removes everything you want it to remove

Step 2 - Configure the artifacts you want as shared artifacts in one of your Jobs. Bamboo should grab them after the build runs via the 'Artifact Copier' processor.

Step 3 - Setup the Pre/Post Build Plugin and configure a Post-build action to run your build tools 'clean' target

As a Step1a, you could just code up your own 'clean' function using a batch script or something simple like that.

Hopefully, that gets the behaviour that you want.

Thanks for ths tips. My build has 5 jobs run on multiple agents, does the Post build script run on each agent ?

It's tied to a Job, so yes.

Got the plugin installed, but unfortunately it runs *before* the Artifact Copier

15-Dec-2011 12:39:09command is: ant clean

15-Dec-2011 12:39:09 build was successful, running success command

15-Dec-2011 12:39:09[BuildCommandRunner] running command: ant clean

15-Dec-2011 12:39:10Running post build plugin 'Artifact Copier'

15-Dec-2011 12:39:10Publishing an artifact: Db.zip

This widget could not be displayed.

You can't achieve that with stock Bamboo. You can either use a plugin like Pre/Post Build Plugin or code your own simple plugin by implementing CustomBuildProcessor interface.

I have that plugin installed but the UI in the documentation does not look like mine (I'm running Bamboo 3.2 build 2600), I do not see a 'Post Action' tab anywhere, all I see is the 'Post Build Command' on the Miscellaneous tab of the Job configuration, and that runs before the Artifact Copier.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

144 views 2 0
Join discussion

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