Create
cancel
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

bypass branch restrictions as permission option for Bitbucket Pipelines?

It seems to me that it's possible to bypass branch restrictions as permission option for Bitbucket Pipelines:

I have configured the following deployment restrictions:

Environment name: Production
Branches allowed to deploy to Production: master

Bitbucket-pipelines looks like this:

branches:
master:
- step:
name: Deploy
deployment: production
script:
- echo "deploy"

This works as expected: I can only deploy my master branch to production and no other branches.


Now I create a branch in which I remove deployment: production from bitbucket-pipelines.
This makes it possible to run pipeline branches:master for this branch, as the branch restriction appears to be out of order.

Is this intended? Is there another way to make it impossible to run master / production pipelines for arbitrary branches?

 

1 answer

1 accepted

1 vote
Answer accepted
Caroline R Atlassian Team Jul 09, 2021

Hi, @Mathijs !

Now I create a branch in which I remove deployment: production from bitbucket-pipelines.

I assume that you edit the yaml file and remove the deployment: production in the new branch you create, is that correct? If this is the case, you are correct. It will be possible to run pipeline branches:master for this branch. Since deployment: production will be missing from the yaml file, this will no longer be a deployment step so the branch restriction cannot be enforced.

However, if you have defined any credentials needed for the deployment as deployment variables,  these deployment variables won't be available in the pipeline branches:master (since it will be missing the "deployment: production" part), and the deployment will fail.

My suggestion would be to use deployment variables for authentication (instead of repository or workspace variables) to the deploy server, as this way the deployment will fail when the "deployment: production" is missing. 

Please, feel free to share any additional questions regarding this case.

Kind regards,
Caroline

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
Community showcase
Posted in Bitbucket

Share your use cases: How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features to how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your tea...

34 views 0 1
Join discussion

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