Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

58 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you