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

1 vote
Accepted answer

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.

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?

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?

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 Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

58 views 3 2
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