Instead of interpreting rev|staging , a much more natural implementation method that will use a sequence of stream styles as a key:
pipelines: branches: [rev, staging]: - step: script: - echo 'step'
This will eliminate the need for quotation marks and that spaces or an extra (comma) comma do not make sense difference. Depending on the library that bitbucket uses for processing, the above may be correctly analyzed but not loaded (for example, PyYAML cannot process the above, but ruamel.yaml ). I have not been able to check if this preferred method really works in bitbucket.
There are two ways to work, one of which uses the familiar YAML functionality of anchors and aliases to provide repetitive (complex) data structures only once:
pipelines: branches: rev: &sharedsteps - step: script: - echo 'step' staging: *sharedsteps
Another possibility, as others have already pointed out, is to use some non-standard interpretation of scalar keys with the bitbucket specification with embedded commas. I did not find clear documentation on this, but the glob patterns seem to be applicable, so you can use {rev,staging} as the key.
Whatโs scary about this is that { this is a sequence indicator in YAML, so you must enclose the scalar in quotation marks:
pipelines: branches: "{rev,staging}": - step: script: - echo 'step'
The above has been updated using the revised step syntax provided by BlueM
source share