We want to setup test branches for our repository (e.g. test/*). We want to automatically run the pipeline for anytime a branch with the prefix of "test/" (e.g. test/new-feature) is updated.
However, we only want 1 active "test/" branch and block the pipeline if another developer pushes a branched called "test/other-new-feature". This way code in the test environment doesn't get overridden by mistake.
Is this possible within pipeline YML file?
Thanks.
Hi Ron,
If you configure a branch pipeline for test/*, it is going to run for all branches with the "test/" prefix.
What you could do instead is use in the bitbucket-pipelines.yml file the exact name of the branch, e.g. test/feature-a. When you finish with this branch and you want to use another test branch for builds, you can edit the bitbucket-pipelines.yml file and change test/feature-a to the name of this other test branch.
Is this something that works for you?
Kind regards,
Theodora
Hi Theodora,
Thanks for the suggestion. That's definitely one way to handle this, however, it won't stop the issue of another developer potentially pushing a test/something-new without checking and overriding the first test/new-feature branch.
Cheers,
Ron
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ron,
I understand your concern.
You mentioned in your question
This way code in the test environment doesn't get overridden by mistake.
If the pipeline has a deployment step or stage, then with the Premium plan you can restrict the branches that are allowed to deploy to a certain deployment environment.
This can be done by admins from Repository settings > Deployments > select a deployment environment > you will see an option Branches allowed to deploy to <deployment_enviornment_name>:
In there, an admin can specify which branches are allowed to deploy to this specific environment.
This would need to be updated every time you want to have deployments run for a different test branch.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.