Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,391
Community Members
 
Community Events
184
Community Groups

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

Edited

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.

 

Solutions

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 :) 

1 comment

we have the same issue with our deployment pipeline. We are using "helm" to deploy services to kubernetes and if someone is stopping the pipline during "helm update" then the process terminates and causing problems for further deployments because of "pending-install" state.

It would be great to have a possibility within bitbucket-pipelines to have something like a "shutdown-hook" to be able to react on the case that someone stops the pipeline in the middle of working, or at least a way on how to disable the "stop" button for some pipelines.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events