Answers: <p>You can manually stop a build in progress. From <a href="https://confluence.atlassian.com/bamboo/stopping-an-active-build-289276913.html" rel="nofollow noreferrer">Stopping an active build</a>:</p>
  <blockquote>
  <p>To stop an active plan build:</p>
  <ol>
  <li>Click Dashboard and then the All Plans tab.</li>
  <li>Click the 'Stop' icon next to the active plan you want to stop.</li>
  </ol>
  </blockquote>
  <p>It also appears possible to stop the build/deploy programmatically, using <a href="https://docs.atlassian.com/atlassian-bamboo/REST/6.8.0" rel="nofollow noreferrer">the REST API</a>, more specifically making a <code>DELETE</code> request to the appropriate url:</p>
  <blockquote>
  <p>/queue/{projectKey}-{buildKey}-{buildNumber : ([0-9]+)}?stage&amp;executeAllStages
  ...
  DELETE
  Stop build execution.</p>
  <p>available response representations:</p>
  <p>401
  Returned when user does not have sufficient rights to view or execute build for specified plan</p>
  <p>204
  On success (success is also when build was already completed - so nothing to stop)</p>
  <p>404
  Returned when specified job does not exist</p>
  </blockquote>
  
Answers: CC BY-SA 4.0
Answers: 2019-12-23T15:05:51.550Z
Answers: 2019-12-23T15:05:51.550Z
Answers: 2020-06-18T08:28:10.803Z
Answers: Dan Cornilescu
Answers: <p>I know that is not the clean solution everybody looks for and is a nasty workaround, but what worked for me was to squash all my deployment logic into a single Script Task (shell script) and then put the necessary conditions there, such as:</p>
  
  <pre><code>if [ &lt;put condition for terminate here&gt; ] ; then 
     exit 0
  fi 
  &lt;Continue with other execution logic&gt;
  </code></pre>
  
  <p>In that way, you can exit with 0 (thus build shows as successful) , but of course that prevents you from reusing all of the out-of-the-box Bamboo Task types that are readily available and questions the benefits of using the bamboo framework as a wrapper.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-04-07T09:50:50.930Z
Answers: 2020-04-07T09:50:50.930Z
Answers: Йордан Неделчев
Body: <p>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</p>
  
  <pre><code>exit 1
  </code></pre>
  
  <p>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.</p>
  
  <p>Does anyone know an elegant way to accomplish a full stop in a Bamboo plan?</p>
  
Comments: CC BY-SA 4.0
Comments: 2018-06-01T14:00:47.143Z
Comments: What about `exit 0` ?
Comments: Tensibai
Comments: CC BY-SA 4.0
Comments: 2018-06-01T14:32:57.910Z
Comments: @Tensibai - exit 0 will make Bamboo continue executing the following steps in the plan, since exit 0 basically means "I'm done and things went fine". I need it to stop executing.
Comments: Culme
Comments: CC BY-SA 4.0
Comments: 2018-06-01T14:34:25.760Z
Comments: Misread it as stopping the script in middle vs stopping the plan. Not using bamboo so I can't tell.
Comments: Tensibai
Comments: CC BY-SA 4.0
Comments: 2018-06-03T09:25:26.270Z
Comments: You can try setting a Bamboo variable and introduce a conditional within each stage/task to check if it should run the desired code or not. Not an elegant way to do it but it should be doable.
Comments: kaizenCoder
Comments: CC BY-SA 4.0
Comments: 2018-06-04T06:45:27.837Z
Comments: @kaizenCoder Thanks. But there are several task types that do not contain scripting, and in those task types - how would one introduce the conditional check?
Comments: Culme
Comments: CC BY-SA 4.0
Comments: 2019-12-20T09:04:56.293Z
Comments: @Culme Did you create an issue at bamboo?
Comments: 030
Comments: CC BY-SA 4.0
Comments: 2019-12-23T11:49:03.297Z
Comments: Hey @030, it's been a while, and to be honest I can't remember whether or not I did.I would guess I did, but got no good reply - but that IS a guess.
  
  I would still need the feature though, and noticing that the question has been closed made me surprised and disappointed. 
  Would you know how to revive it again? (Seing as you appear to be a mod, from your little diamond mark by your name.)
Comments: Culme
Comments: CC BY-SA 4.0
Comments: 2019-12-23T11:50:59.983Z
Comments: Thanks for your reply. I will reopen it. Could you create an issue [in the issue tracker of BamBoo](https://jira.atlassian.com/secure/RapidBoard.jspa?rapidView=2466&projectKey=BAM) and post an answer to this Q&A to create more awareness?
Comments: 030
Comments: CC BY-SA 4.0
Comments: 2019-12-23T12:19:08.447Z
Comments: (On a side note: I did try to open an issue with Atlassian on this today. So I go to Bamboo forum, create feature request - system says feature requests need to be input from another system, I go to the other system, choose Bamboo as product, and the other system says I must use the Bamboo forum to submit a feature request.uuuhm. .... but....
  I would love to start rambling about this, but hopefully the facts ramble by themselves.
Comments: Culme
Tags: <continuous-integration><bamboo>
Title: Halt execution of Bamboo build or deploy, without throwing an exception
UserDisplayName: Culme
ThreadText: # Halt execution of Bamboo build or deploy, without throwing an exception
  
  (Asked by: username_0 on 2018-06-01)
  
  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?
  
  **Tags:** continuous-integration, bamboo
  
  > **Comments:**
  > **username_1**: What about `exit 0` ?  
  > **username_0**: @username_1 - exit 0 will make Bamboo continue executing the following steps in the plan, since exit 0 basically means "I'm done and things went fine". I need it to stop executing.  
  > **username_1**: Misread it as stopping the script in middle vs stopping the plan. Not using bamboo so I can't tell.  
  > **username_2**: You can try setting a Bamboo variable and introduce a conditional within each stage/task to check if it should run the desired code or not. Not an elegant way to do it but it should be doable.  
  > **username_0**: @username_2 Thanks. But there are several task types that do not contain scripting, and in those task types - how would one introduce the conditional check?  
  > **username_3**: @username_0 Did you create an issue at bamboo?  
  > **username_0**: Hey @username_3, it's been a while, and to be honest I can't remember whether or not I did.I would guess I did, but got no good reply - but that IS a guess.  I would still need the feature though, and noticing that the question has been closed made me surprised and disappointed.  Would you know how to revive it again? (Seing as you appear to be a mod, from your little diamond mark by your name.)  
  > **username_3**: Thanks for your reply. I will reopen it. Could you create an issue [in the issue tracker of BamBoo](https://jira.atlassian.com/secure/RapidBoard.jspa?rapidView=2466&projectKey=BAM) and post an answer to this Q&A to create more awareness?  
  > **username_0**: (On a side note: I did try to open an issue with Atlassian on this today. So I go to Bamboo forum, create feature request - system says feature requests need to be input from another system, I go to the other system, choose Bamboo as product, and the other system says I must use the Bamboo forum to submit a feature request.uuuhm. .... but.... I would love to start rambling about this, but hopefully the facts ramble by themselves.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_4 on 2019-12-23. Score: 1
  
  You can manually stop a build in progress. From [Stopping an active build](https://confluence.atlassian.com/bamboo/stopping-an-active-build-289276913.html):
  
  > To stop an active plan build:
  >
  > 1. Click Dashboard and then the All Plans tab.
  > 2. 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](https://docs.atlassian.com/atlassian-bamboo/REST/6.8.0), 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
  
  
  ---
  
  ### Answer by username_5 on 2020-04-07. Score: 1
  
  I know that is not the clean solution everybody looks for and is a nasty workaround, but what worked for me was to squash all my deployment logic into a single Script Task (shell script) and then put the necessary conditions there, such as:
  
  ```
  if [ <put condition for terminate here> ] ; then 
     exit 0
  fi 
  <Continue with other execution logic>
  
  ```
  
  In that way, you can exit with 0 (thus build shows as successful) , but of course that prevents you from reusing all of the out-of-the-box Bamboo Task types that are readily available and questions the benefits of using the bamboo framework as a wrapper.
  
  
  ---
  
  