HiveBrain v1.2.0
Get Started
← Back to all entries
debugMinor

Halt execution of Bamboo build or deploy, without throwing an exception

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
withoutexceptionbamboodeploythrowinghaltbuildexecution

Problem

This seems so trivial, I am almost shy to ask...
Depending on certain conditions, which I am able to check by looking at Bamboo variables, I sometimes want to just stop the execution of a build and/or it's deploy. The possibility to conditionally execute steps seems very limited in Bamboo, and I am having trouble solving this.
I found a workaround, which is running a script that exits with an error, like a powershell script simple as this

exit 1


But that obviously causes the build to appear as failed, which really isn't what I want. I just want to prevent a deploy in certain conditions.

Does anyone know an elegant way to accomplish a full stop in a Bamboo plan?

Solution

You can manually stop a build in progress. From Stopping an active build:

To stop an active plan build:

  • Click Dashboard and then the All Plans tab.



  • Click the 'Stop' icon next to the active plan you want to stop.



It also appears possible to stop the build/deploy programmatically, using the REST API, more specifically making a DELETE request to the appropriate url:

/queue/{projectKey}-{buildKey}-{buildNumber : ([0-9]+)}?stage&executeAllStages
...
DELETE
Stop build execution.

available response representations:

401
Returned when user does not have sufficient rights to view or execute build for specified plan

204
On success (success is also when build was already completed - so nothing to stop)

404
Returned when specified job does not exist

Context

StackExchange DevOps Q#4218, answer score: 1

Revisions (0)

No revisions yet.