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'
Parallel steps enable you to build and test faster, by running a set of self-contained steps at the same time.
Bitbucket Pipelines is an integrated CI/CD service built into Bitbucket. It allows you to automatically build, test, and even deploy your code based on a configuration file in your repository. Essentially, we create containers in the cloud for you.
In Bitbucket, go to the repository you want to scan and select Settings > Pipelines > Environment variables. Verify the Secured checkbox is selected. Click Add.
A comma-separated list inside braces appears to work:
pipelines: branches: '{rev,staging}': - step: script: - echo 'step'
This is a full example on how you can reuse some steps:
image: yourimage:latest definitions: services: ... # Service definitions go there steps: - step: &Test-step name: Run tests script: - npm install - npm run test - step: &Deploy-step name: Deploy to staging deployment: staging script: - npm install - npm run build - fab deploy pipelines: default: - step: *Test-step - step: *Deploy-step branches: master: - step: *Test-step - step: <<: *Deploy-step deployment: production trigger: manual
Read more about YAML anchors: https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With