Accessing the required agent capabilities for a job from a pre stage action module.

I'm trying to write a Bamboo plugin that can signal our remote agent manager to spawn the required remote agents on our HPC cluster as a pre-stage action. All our plan jobs specify a number of custom capabilities used by the HPC cluster and the remote agents are spawned with these capabilities by the manager.

My problem is that I can't find how to access the required capabilities for the jobs within the stage. I can access the BuildExecution and BuildContext from the StageExecution which seem to be able to provide some of the information but I can't find the job requirements (set on the requirements tab of the job configuration).

Please can someone point me in the right direction! Thanks for your assistance.

1 answer

1 accepted

0 votes
Accepted answer

Since this is happening on server, you should be able to use Spring-injected CachedPlanManager to retrieve Job object

//fetch Job from Plan cache
Job myJob = cachedPlanManager.getPlanByKey(buildExecution.getPlanResultKey().getPlanKey(), Job.class);

//and now you can read requirements:
RequirementSet requirements = myJob.getEffectiveRequirementSet()

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

4,446 views 20 13
View question

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