I have a long step that I would like to trigger automatically from the `staging` and `dev` branch, but manually in prod.
I have this:
branches:
'{dev,staging,prod}':
- step:
name: Ship It!
trigger: manual
I was wondering if I could do something like this:
branches:
'{dev,staging,prod}':
- step:
name: Ship It!
# pseudocode
trigger: ${ $BITBUCKET_BRANCH=="prod" ? "manual" : "automatic" }
... or is there a better way to do this?
Hi Mike and welcome to the community!
I'm afraid that syntax like the one you suggested is not possible.
I believe the simplest way to achieve what you want would be to define an automatic step for dev and staging branches only, like this:
pipelines:
branches:
'{dev,staging}':
- step:
script:
- ...
In this case, a build will run automatically for every new commit in dev and staging branch.
No build will run automatically for every new commit in prod branch.
However, if you open a commit of the prod branch in Bitbucket UI, you can select the option Run pipeline (at the right side of the page) and then select to run the pipeline branches: {dev,staging} for this commit.
Is this something that works for you?
Kind regards,
Theodora
Yes, it sounds like that would work, although I may just extract the whole prod pipeline and just change that one variable there.
Ultimately it might be a nice feature to have simple expression handling so you can generate strings inside yaml values with a simple templating language.
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.