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

Christopher Dancy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 10, 2012

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
Answer accepted
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 12, 2012

Try using SystemDirectory class methods to get to artifact directories.

Christopher Dancy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

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.

0 votes
Christopher Dancy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

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

0 votes
Christopher Dancy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 10, 2012

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?

https://answers.atlassian.com/questions/66252/bamboo-api-lazy-init-exception-thrown-while-iterating-through-plans-and-build-results

0 votes
Christopher Dancy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 10, 2012

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?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events