Bitbucket Pipelines - multiple branches with same steps

Gery Teague picture Gery Teague · Feb 17, 2017 · Viewed 15.3k times · Source

Is it possible to combine multiple branches that have the same steps within bitbucket pipelines?

ex: The teams I work on use one of two names for their review branches, either "rev" or "staging". Either way the same steps are used to publish to our review server. Right now the branches are called out separately.

pipelines:
     branches:
          rev:
               steps:
                    - echo 'step'
          staging:
               steps:
                    - echo 'step'

but could it be something like

pipelines:
     branches:
          rev|staging:
               steps:
                    - echo 'step'

Answer

RH Becker picture RH Becker · Jul 2, 2017

A comma-separated list inside braces appears to work:

pipelines:
  branches:
    '{rev,staging}':
      - step:
        script:
          - echo 'step'