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

Pipelines repository settings: graceful shutdown / only admin can stop pipeline


Our use case

In our system anybody can start a pipeline and approve a deployment. A deployment to production can be manually approved after a series of robust tests and build phases across multiple branches.

We have a continuous deployment system running in Bitbucket Pipelines, and the last step is performed by Terraform. Terraform provisions our infrastructure as it is defined in code across our repositories, and programmatically makes changes to our infrastructure if there are any differences in configuration.


Problem statement

Terraform, along with many other deployment systems, can only operate one instance/session per environment at a time. This is facilitated by a remote locking mechanism which is read/written to by all deployers and pipelines.

If a Bitbucket Pipelines pipeline step is "stopped", it does not gracefully shut-down. Ordinarily Terraform will be gracefully stopped (for example if Ctrl+C is hit in terminal) and the remote lock is released.

With Bitbucket Pipelines, anybody can force immediate termination of the pipeline script which results in our infrastructure half-updated and the state remains locked.



This problem is not limited to Terraform, it applies to any deployment system which relies on a locking mechanism. Below are my suggestions for resolving this problem:

  1. Repository Settings -> Pipelines -> Toggle: "Stop" will issue a shutdown command to the process, consuming build minutes until the process terminates.
  2. Repository Settings -> Pipelines -> Toggle: Only admins can stop a pipeline. 


If anybody else is experiencing a similar issue, has a workaround, or otherwise has any feedback, then please contribute to this discussion :) 



Log in or Sign up to comment
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,725 views 10 16
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