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

Bamboo release version creation via REST API problem

Hi everyone!

My question is all about Bamboo REST API.

When I try to create new release via REST API, I get a strange error, and I really see no way to fix it (googled a whole lot, please believe me).

The request itself is set up as per documentation

curl -H "Content-Type: application/json" -H "Accept: application/json" -u ${bamboo_CI_LOGIN}:${bamboo_CI_PASSWORD} -X POST "https://bamboo.<domain_name>/rest/api/latest/deploy/project/${DEPLOY_ID}/version" --verbose -d @- << EOF
"planResultKey": "<build_plan_result_key>-<buildnumber>",
"name": "sometest-1",
"nextVersionName": "sometest-2"

But I get an obscure message for the response that actually explains nothing:

"Can not create version, passed result <build_plan_result_key> has different master than plan associated with deployment project <build_plan_key>"

What is wrong with it? My deployment project is definitely linked with "master" branch, but I can create releases via UI without any need of changing project configuration, just select another branch and its build result and voila! - a fresh new release is here and being deployed. 

So what should I do to be able to create release from build results without that nagging error?

1 answer

0 votes

This error message means that build_plan_result_key and build_plan_key not belong to same master plan, e.g. they don't have common ancestor or build_plan_key don't have plan branch builds with given build_plan_result_key

I'm sorry, but I should admit you're utterly wrong.

I've came across the situation during a new release creation investigation from 'develop' branch result of the build plan that definitely has 'master' branch.

I'd be perfectly happy to see the link to REST API documentation which explains or even mentions this behavior that renders this given endpoint completely useless, as I cannot see any plan/branch/linked plan etc. mentions.

Meanwhile, I've managed to find out that there's a pretty good API call without all those vague undocumented requirements.

The endpoint that works is "https://bamboo.<domainname>/deploy/doCreateDeploymentVersion.action", and here's the parameter list:
linkedPlanKey=${BUILDPLANKEY}, deploymentReleaseBranch=${BUILDPLANKEY},

That's it, and it binds no requirements on me.

The current endpoint implementation requires some obscure conditions that are even undocumented; however, the purpose of this endpoint is definitely clear: I've a build key for a given build result, and I want to create a release. The same is done via UI routinely and without any efforts, so why this pure-backend call can't do the same? I wonder if you could you please consider implementing this behaviour in the REST API I've mentioned earlier?

I'm sorry to hear about misbehaviour of REST endpoint you mentioned. It was designed exactly to avoid usage of doCreateDeploymentVersion.action and have same functionality.

May I ask you to report support case so we could check reasons it doesn't work at your environment

Like tnt4brain likes this

Yes, sure: our support agreement is in effect.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo Data Center 8.1 is now available

G’day Bamboo customers, Bamboo DC 8.1 is now available with it the following features and programs: SAML 2.0, OpenID Connect, and Crowd SSO In order to help admins with a simplified user manage...

197 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