I want to have two workflows:
- one for all branches but testing
- second for only testing branch ,
how trigger pattern should looks to achieve that( all branches exclude one?)
I want to have two workflows:
Hi @maciega_fm,
great question! You can archive it with following trigger map:
trigger_map:
# second (testing-workflow) for only testing branch - triggered by PR or Push
- push_branch: testing-branch-name
workflow: testing-workflow
- pull_request_source_branch: testing-branch-name
workflow: testing-workflow
# one (primary) for all branches but testing - triggered by PR or Push
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
Yep, @godreikrisztian is right, just a note: the important thing here is that the order of trigger_map
processing in top-to-bottom, and the first item which matches the conditions will pick the workflow for the build.
So if you have:
trigger_map:
- push_branch: testing-branch-name
workflow: testing-workflow
- push_branch: "*"
workflow: primary
Then when a push happens on the testing-branch-name
branch that will match the first pattern and select testing-workflow
. In case of a push to any other branch the push_branch: testing-branch-name
entry wonβt match, so the processing of the trigger_map
continues and then matches push_branch: "*"
which selects the workflow for the build.
But if you switch the order of the entries:
trigger_map:
- push_branch: "*"
workflow: primary
- push_branch: testing-branch-name
workflow: testing-workflow
Then the first entry (push_branch: "*"
) will always match the push condition before the push_branch: testing-branch-name
one, and so the push_branch: testing-branch-name
one will never be used.
You can find more information and examples in the official docs at: http://devcenter.bitrise.io/webhooks/trigger-map/
If you have any questions, just let us know!
Thank you for that. I had no idea that it was a top-to-bottom matcher. That clears things up tremendously.