I want to limit certain step to specific branches
pipelines:
branches:
'{feature/*,release/*,hotfix/*,bugfix/*}':
- step: # Generates credential needed for test and building
script:
- echo "All branch, this step is needed for release"
- parallel:
script: # Some lint and unit test script
- echo "All branch, this step is needed for release step"
'{release/*}':
- step: # Actual test and build script
script:
- echo "Only in release branch"
In the above sample I want the first step to run in almost all branch, but the second step should only execute for release branches pattern. Unfortunately the actual result was the first step only works in branches like hotfix and never gets trigger in release/version-name when branching out. How is it supposedly done? Basically the idea is to reuse the first two steps above on release branches, so no need to duplicate those steps.
Hi Jensen, I think you should use yaml anchors to define the common steps and reuse them in the appropriate pipelines - `release/*` or `hotfix/*`.
Ref: https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.