Pipelines permissions and conditions

Hello,

 

First, congratz to the team for such a good feature, very quick and easy to implement a full ci/cd cycle with pipelines.

 

2 questions:

1. I want to add a manual (custom) pipeline run in the yml file.
How can i restrict permissions on who is allowed to run this custom build ?

 

2. I want this build to be runable only on the master branch, how can i limit this ?
I am thinking of a custom step, and checking the $BITBUCKET_BRANCH in the yml..
But there might be an easier way ?

 

Thanks,

 

Luc

 

3 answers

Ability to restrict permissions for manual/custom pipelines would be a massive help for us..

For permissions, no. No answer at all.. great.

For branch selection, i added a step with a custom bash script that validates the branch name (sent as parameter by pipelines to the script)

- sh deploy/pipelines-validate-branch.sh $BITBUCKET_BRANCH demo

 

script:

 

#!/bin/bash
# expects the source branch as first parameter, and the target environment as 2nd
echo "source branch: " $1
echo "target environment: " $2
# can only deploy master on master
if [ $2 = "master" -a $1 != "master" ];
then
echo
"Deployment on master is not allowed from the branch $1 (only from master)"
exit 1
fi
# can deploy dev and master on demo
if [ $2 = "demo" -a $1 != "master" -a $1 != "dev" ];
then
echo
"Deployment on demo is not allowed from the branch $1 (only from dev and master)"
exit 1
fi
# other manual deploy will fail
if [ $1 != "dev" -a $1 != "master" ];
then
echo
"Manual deployment is not possible from this branch (only from dev and master)"
exit 1
fi

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,666 views 26 12
Join discussion

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