Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Bamboo: How to get an AdministrationConfigurationManager in a CustomPrebuildAction?

I am trying to build a CustomPrebuildAction and need to access the resultsUrl from inside it.

Through similar posts here and elsewhere on the internet I have found that I can piece the resultsUrl together from base url and the plan result key.

I have managed to retrieve the plan result key via the build context, but I can't figure out how to get the base url.

I have read in a different post that I can try to get an AdministrationConfigurationManager injected, but it seems this is only valid for plugin modules of type Task.

In my CustomPrebuildAction I get a dependency injection error.

Does anybody know how to get an AdministrationConfigurationManager in a CustomPrebuildAction or else how to figure out the base url in a different way or even how to get a complete resultsUrl?

 

Thanks in advance,

 

Michael

1 answer

1 accepted

1 vote
Answer accepted

I managed to get this working by using an AdministrationConfigurationAccessor instead which I retrieved via the ComponentLocator:

 

public class MyCPBA implements com.atlassian.bamboo.build.CustomPreBuildAction {

private AdministrationConfigurationAccessor administrationConfigurationAccessor = ComponentLocator.getComponent(AdministrationConfigurationAccessor.class);

 

Seems to work fine, I managed to retrieve the resultsUrl correctly.

AdministrationConfiguration config = administrationConfigurationAccessor.getAdministrationConfiguration();
String resultsUrl = config.getBaseUrl() + "/browse/" + buildContext.getPlanResultKey().toString();

 

HTH,

 

Michael 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events