Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


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
Community Members
Community Events
Community Groups

How to access buildKey bamboo variable in the atlassian-plugin.xml

I need to paas the buildKey as a query parameter to the link defined in the web-item in atlassian-plugin.xml. currently I am passing the planKey, however it fails to load the Results saying the Plan XYZ not found. When I manually alter the URL, the report is rendered.

<link linkId="XYZ">/build/result/ViewBuildReport.action?planKey=${planKey}&amp;buildNumber=${buildNumber}</link>


here the plan key that is generated is PROJ1-PLAN1 ,the report however fails to laod, saying PROJ1-PLAN1 not found. When I manually change the URL to PROJ1-PLAN1-JOB1 , the reports are rendered. This problem is occuring in Bamboo 5.9.7 version and not on latest.

In order to get the URL in the form PROJ1-PLAN1-JOB1 , I need to get the right bamboo variable, buildKey can get the value, but it is returning empty null string. I tried using buildKey=${buildKey} or buildKey=${bamboo.buildKey}, nothing works.So how to get this to work? I am not able to process the artifacts directory also due to this issue.


2 answers

@Nikita Bedmutha I've same error did you find any solution?

btw i'm trying to put a link for a report in atlassian-pom.xml


If you select a job name in left menu which is

 section="results.subMenu/results" -> buildKey = ABP-PLAN-JOB1-3


But in opening screen of a build, if you don't select anything then 

section="chainResults.subMenu/chainResults" -> buildKey = ABP-PLAN

0 votes

This should work conceptually, are you correctly passing the variable to the builder? This is a required step that's easy to forget, see Passing Bamboo variables to a build script:

Bamboo global and build specific variables can be referred to in build scripts or maven pom.xml. Bamboo variables are not directly available in the builder execution context however. They can be passed as parameters to the builder. [emphasis mine]

So for e.g. Maven you'd need something like this to reference the Bamboo variable ${bamboo.buildNumber} as a Maven property ${bambooBuildNumber} within a file processed by the build (more details):

clean package -DbambooBuildNumber=${bamboo.buildNumber}

Thanks Steffen, but yes, I am using it correctly as ${buildKey} in my bamboo plugin's atlassian-plugin.xml. This gives value as PROJ1-PLAN1, but what I expect for my report is PROJ1-PLAN1-JOB1, the full buildKey and not planKey. But it gives PROJ1-PLAN1 only for buildKey also. As a result, Bamboo throws error 'An unexpected error occured', PROJ1-PLAN1 not found. If I hit the URL with query string PROJ1-PLAN1-JOB1, that works fine.


Also, I tried injecting variables but they are not accessible too from within atlassian-plugin.xml

I see, sorry I misread your question - to further clarify the issue:

  1. Your two statements "buildKey can get the value, but it is returning empty null string" and now "${buildKey} [...] gives value as PROJ1-PLAN1" seem to contradict each other?
  2. Does your statement "This problem is occurring in Bamboo 5.9.7 version and not on latest" mean that it works correctly with say Bamboo 6.5.0?

1. Sorry for the confusion, but ${buildKey} returns value as 'PROJ1-PLAN1'.

2. Yes, this problem occurs in 5.9.7. So when tried same on 6.5.0, ${buildKey} returns same PROJ1-PLAN1, but it renders the contents of the action correctly, while in 5.9.7, URL built using this value says, PROJ1-PLAN1 not found i.e.<PLAN_KEY> not found. And on manually changing the URL to PROJ1-PLAN1-JOB1, it renders the contents of the action web item. On 6.5.0, contents are rendered correctly for both values w/ and w/o JOB1. 

So I was searching for some bamboo variable which will give me value PROJ1-PLAN1-JOB1, but I tried almost all available in documentation, but none of them works as required. Also I am not sure, but can this issue be due to change in directory structure for the artifacts which was introduced post 5.9.?

My web item action is the ViewBuildResults calss which is used to render some reports generated during build step.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events