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

locking a step

Oliver Beck June 14, 2021

Hi

is it possible to lock a single step? here's an example of what I need:

  • dev 1 pushes to a branch, pipeline starts running, step1 is triggered and is running. step1 deploys the codebase to a dedicated test environment, tests will be executed on that environment. it can take up to 10 minutes until step1 is finished
  • dev 2 pushes to another branch, pipeline starts running, step1 is triggered. now the 2 running pipelines will get in conflict: dev 2 will hijack the test env of dev 1, before his tests are passed

is it possible to lock step1, so when step 1 is triggered but "locked", the pipeline will wait until it is unlocked

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 22, 2021

Hi Oliver,

At the moment, it is possible to do this using Bitbucket Deployments. Deployment environments can be configured via Repository settings > Deployments. There are 3 default ones, so you can use any of them.

If e.g. you have a bitbucket-pipelines.yml file like the following:

pipelines:
default:
- step:
name: Testing
script:
- <commands_here>

You can add the deployment keyword along with the name of the environment, as follows:

pipelines:
default:
- step:
name: Testing
deployment: Test
script:
- <commands_here>

If a deployment step to "Test" is already running because of a commit to branch A, and another developer pushes a commit to branch B, then the build triggered by the second commit will be paused.

I'm afraid that the paused build doesn't get resumed automatically though, someone will need to resume the build manually after they open it from the Pipelines page of the repo (we have a feature request for automatic resuming of paused deployment steps: https://jira.atlassian.com/browse/BCLOUD-16304).

If you have a different definition for each branch, then you could do the following, and the behavior will also be the same:

pipelines:
branches:
master:
- step:
deployment: Test
script:
- <commands>
develop:
- step:
deployment: Test
script:
- <commands>

Is this something that works for you?

We don't have any concurrency control for non-deployment steps at the moment, however, that's a feature that has been requested by others as well https://jira.atlassian.com/browse/BCLOUD-16262.

If you're interested in any of the features I mentioned, I would suggest that you add your vote there (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events