How to execute module (PostBuildCompletedAction) after artifacts published and how to get artifacts

I'm writing a 'CustomPostBuildCompletedAction' module for bamboo and want it to run at the last possible second or at least after all artifacts have been published. Is there a "weight" attribute I can give to the xml descriptor for "PostBuildCompletedAction" or should I be using a different module altogether?

4 answers

1 accepted

This widget could not be displayed.

Try using SystemDirectory class methods to get to artifact directories.

Thanks. I was not aware this class existed. Much cleaner and fault-tolerant solution to grabbing the bamboo-home-dir than what I came up with.

This widget could not be displayed.

The CustomBuildProcessorServer module does exactly this but I still can't seem to get to the artifacts in anyway. I tried using the BuildResultsSummaryManager and subsequently getting the ResultsSummary but exceptions are thrown trying to iterate over the Collection<AtrifactLink> (via getArtifactLinks()):

[INFO] [talledLocalContainer] net.sf.hibernate.LazyInitializationException: Fail

ed to lazily initialize a collection - no session or session was closed

This is odd considering the collection itself is non-null but attempting to iterate over it throws an exceptions. Is there anyway I can get at the artifacts from the CustomBuildProcessorServer module?

This widget could not be displayed.

Following the advice from the below thread I was able to execute the necessary calls but the returned Collection<ArtifactLink> is of size 0. However at the time of execution the artifacts are clearly on disk so I'm not exactly sure why Bamboo is not picking this up. Is there a way to grab the artifact root directory somehow?

This widget could not be displayed.

To get the "artifact root" (because there was no way I could find to grab it through the API and it's related classes) directory I grabbed the "bamboo.home" property from system-properties and simply worked my way up to the relevant artifact directory using the plan-key, artifact-name, and artifact-file-name. Not sure if this is the correct way to go about things but it worked for my case.

EDIT: use of class SystemDirectory has all the classes one would need to find bamboo-home-dir

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

171 views 1 3
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