Scenario:
I have a ~10 line pipeline step that I want to define once and run against every commit to master, every time a PR is created, and every commit to a branch with an open PR.
How can I define a pipelines config to do this, with as little repetition as possible? I'd like to avoid re-defining the exact same step 2 or 3 times.
Hi @Aaron Bauman
I hope that this example can help you to reproduce the configuration:
definitions:
step: &myCommonStep
script:
- echo "command 1"
- echo "command 2"
pipelines:
pull-requests:
'**':
- step: *myCommonStep
branches:
master:
- step: *myCommonStep
default:
- step:
script:
- echo "command 3"
- echo "command 4"
In the example above the step myCommonStep will only run for pull requests and the master branch (running commands 1 and 2). All other commits coming to different branches will trigger the default section which will run command 3 and 4 only.
Let me know if you have more questions about this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.