I want to add a conditional check on my .yml file to filter out which branched the pipelines should run on. The reason behind this being, it is still possible to manually trigger a build on a feature or bugfix branch by any user.
script: - echo "Running on branch $BITBUCKET_BRANCH" - if [ "$BITBUCKET_BRANCH" != "development" ] && [ "$BITBUCKET_BRANCH" != "main" ]; then echo "Pipeline execution is restricted to the development and main branches." exit 1 fi
This is my working logic.
Why is this being overridden on manual runs?
Hi Amitav,
Unfortunately - it's not yet possible to restrict who is able to run pipelines using the manual trigger feature. We have a feature request below that you may Watch for future updates and Vote for to improve its visibility with regard to customer demand:
The only preventative measures available are for Premium customers and they relate to deployments specifically - wherein deployments to certain environments may be restricted to admins only, and only for certain branches, this is not for all Pipelines in general however:
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.