Given a build result key (e.g., BAM-BOO-23), how do I find the associated release created in a deployment plan? I need a way to find this information through the REST API.
Here's the trouble I'm having:
*I can't find associated release information anywhere in the build result's REST resources.
*Deployment plan REST resources only contain the associated build result if that build result produced an artifact. Not all of my plans produce artifacts, and I can't start making them produce artifacts just for the sake of keeping build information.
I have an approach that could solve this issue. It is not an elegant solution (a direct rest), but at least It will give you what you need.
curl -u <USER>:<PASSWORD> \It should give you a result like:
-X GET -p <BAMBOO_URL>/rest/api/latest/deploy/project/forPlan?planKey=<PLAN-KEY> \
| jq -r '. | "Name: " + .name + "\tdeploymentId: " + (.id|tostring)'
Name: <DEPLOYMENT_NAME> deploymentId: <DEPLOYMENT_ID>
curl -u <USER>:<PASSWORD> \As a result, you should get:
-X GET -p '<BAMBOO_URL>/rest/api/latest/deploy/project/<DEPLOYMENT_ID>' \
| jq -r '.environments | "Name: " + .name + "\tenvironmentId: " + (.id|tostring)'
Name: <ENVIRONMENT_NAME> environmentId: <ENVIRONMENT_ID>
curl -u <USER>:<PASSWORD> \This one should give you the deploymentResultId you need:
-X GET -p '<BAMBOO_URL>/rest/api/latest/deploy/environment/<ENVIRONMENT_ID>/results' \
| jq -r '.results | "Version: " + .deploymentVersionName + "\treasonSummary: " + .reasonSummary'
Version: <VERSION> reasonSummary: Child of <a href="<BAMBOO_URL>/browse/<BUILD-RESULT-KEY>"><BUILD-RESULT-KEY></a>
The last one will give you the information you need even if there is no artifact associated to that build.
I hope that helps.
You are correct. And considering what you shared, the only option I see now is the direct access to DB:
SELECT CONCAT(dvp.plan_key, CONCAT('-',dvp.build_number)) build, dv.plan_branch_name, dv.name FROM deployment_version dv LEFT JOIN dep_version_planresultkeys dvp ON dv.deployment_version_id = dvp.deployment_version_id
I also created a feature request for this:
I hope that helps you to move forward.
Hi @Daniel Santos apologies for reviving an old post. I am currently playing around with the Bamboo rest api and am trying to get the deployed version to an environment. Currently below works for me:
however it seems I need to be authenticated even though my deployment environment allows anonymous users to view (I can view this info even when logged out through the ui)
I am thinking possibly this endpoint also returns details that requires you to be logged in.
is there another endpoint I can call to give me deploymentVersionName without auth?
Other details like:
would be nice as well, but no biggie if not possible without auth for these ones.
G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...
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