How to coordinate deployments with pipelines?

We've been testing out Bitbucket Pipelines over the last days and so far we're quite happy with the concept and its simplicity. There is one Problem we can't solve so far: When deploying from within Bitbucket Pipelines how can we ensure that the newest build is deployed? If we have quick commits (quick depending on the time the build takes) we end up with a race between multiple builds.

Our setup is that we want every commit to the develop branch to be directly deployed to our staging environment, In our case these are usually php applications and we're using Deployer for the actual deployment.

Update Found an open issue that would fix this: https://bitbucket.org/site/master/issues/12821/sequential-pipelines-disable 

1 answer

1 vote

Hi Marcel,

You have already found the issue to which I was going to link you. It's something we're looking into and if you have any thoughts about specific features you would like there I would invite you to comment on the open ticket. The best workaround I can think of is to add a step immediately before the deployment step which checks whether there are new commits and only if there are none does it deploy. This will not eliminate race conditions and will not deploy every version, only the latest. However, it should prevent in most cases the overwriting of deployments.

git fetch origin/<release_branch_name>
git diff origin/<release_branch_name>
if [ $? == 0 ]; then ./deploymentScript; fi

Cheers,

Tom.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

2,034 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you