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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,641,978
Community Members
 
Community Events
196
Community Groups

ChainCompletedEvent does not show branchName, prKey etc values

Edited

Dear Bamboo Dev

We have switched from BuildFinishedEvent to ChainCompletedEventHandler (https://docs.atlassian.com/atlassian-bamboo/2.7/com/atlassian/bamboo/event/ChainCompletedEvent.html, https://developer.atlassian.com/server/bamboo/bamboo-event-listeners/) to send some data from bamboo to a different server only after all build/ tests are successful for a given repository.

However it looks like this event handler does not always contain generic values like:

bamboo.planRepository.<position>.branch or bamboo.repository.pr.key

 

I have debugged code with 

@EventListener
public void myChainCompletedEvent(ChainCompletedEvent event) {
LOGGER.error("@@DEBUG myChainCompletedEvent.event.getChainExecution().isSuccessful()"+event.getChainExecution().isSuccessful());
LOGGER.error("@@DEBUG myChainCompletedEvent.getBuildContext"+event.getBuildContext());
LOGGER.error("@@DEBUG myChainCompletedEvent.event.getBuildContext().getCurrentResult().getCustomBuildData()"+event.getBuildContext().getCurrentResult().getCustomBuildData());
LOGGER.error("@@DEBUG myChainCompletedEvent.getPlanKey().getKey().toLowerCase()"+event.getPlanKey().getKey().toLowerCase());

if (event.getChainExecution().isSuccessful()) {
BuildContext buildContext = event.getBuildContext();
Map<String, String> customBuildData = buildContext.getCurrentResult().getCustomBuildData();
int buildNumber = buildContext.getBuildNumber();
if (acceptedToTest(event.getPlanKey().getKey().toLowerCase())) {
String branchName = customBuildData.get("planRepository.branchName");
String branchName1 = customBuildData.get("planRepository.1.branchName");
String branchName2 = customBuildData.get("planRepository.2.branchName");
String branchgitName = customBuildData.get("planRepository.branch");
String branchgitName1 = customBuildData.get("planRepository.1.branch");
String branchgitName2 = customBuildData.get("planRepository.2.branch");
String prKey = customBuildData.get("repository.pr.key");
String branchRevision = customBuildData.get("planRepository.revision");
String repositoryUrl = customBuildData.get("planRepository.repositoryUrl");
LOGGER.error("@@DEBUG myChainCompletedEvent..generic..planRepository.branchName"+branchName);
LOGGER.error("@@DEBUG myChainCompletedEvent..generic..planRepository.branchName"+branchName1);
LOGGER.error("@@DEBUG myChainCompletedEvent..generic..planRepository.branchName"+branchName2);
LOGGER.error("@@DEBUG myChainCompletedEvent..git..planRepository.branch"+branchgitName);
LOGGER.error("@@DEBUG myChainCompletedEvent..git..planRepository.branch"+branchgitName1);
LOGGER.error("@@DEBUG myChainCompletedEvent..git..planRepository.branch"+branchgitName2);
LOGGER.error("@@DEBUG myChainCompletedEvent..generic..repository.pr.key"+prKey);
LOGGER.error("@@DEBUG myChainCompletedEvent..generic..planRepository.revision"+branchRevision);
LOGGER.error("@@DEBUG myChainCompletedEvent..generic..planRepository.repositoryUrl"+repositoryUrl);


//BuildInfo buildInfo = calculateBuildInfoData(buildNumber,branchName,repositoryUrl,branchRevision,prKey);
//InfoSenderQueues.addBuildToTest(buildInfo);
}
}
}

 but it shows in log:

`

ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent.event.getChainExecution().isSuccessful()true
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent.getBuildContextcom.atlassian.bamboo.v2.build.BuildContextImpl@68af0b1c
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent.event.getBuildContext().getCurrentResult().getCustomBuildData(){plan.storageTag=plan-652314331}
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent.getPlanKey().getKey().toLowerCase()rtb-nrb17131
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..generic..planRepository.branchNamenull
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..generic..planRepository.branchNamenull
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..generic..planRepository.branchNamenull
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..git..planRepository.branchnull
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..git..planRepository.branchnull
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..git..planRepository.branchnull
2022-01-14 15:18:51,412 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..generic..repository.pr.keynull
2022-01-14 15:18:51,413 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..generic..planRepository.revisionnull
2022-01-14 15:18:51,413 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-14] [DiffsAnalyzer] @@DEBUG myChainCompletedEvent..generic..planRepository.repositoryUrlnull

`

Is this a bug, or what explains that there is (in our case) ONE build plan which does not publish these variables in customBuildData?

How it can be fixed?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events