Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Stage option in custom branch

Vadym Polietaiev October 2, 2023
In structure with custom where possible to use -stage option (multi-step deployment)?

pipelines
:
custom:
dev:
- step:
<<: *save-env-variables
deployment: development
- step: *restart-api
....
branches:
dev:
- step*build-api
- parallel:
- step: *deploy-api
step: *deploy-services

Also how to change VS Code bitbucket scheme to correctly work with "stage option" which in beta? Or maybe exist shema for beta version?

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2023

Hello @Vadym Polietaiev !

And thanks for reaching out to Atlassian Community!

It's definitely possible to use stages in custom-triggered branches to have multi-step deployments.

From your example YML file, I see you are also leveraging YML anchors to define the steps, so let me share with you an example using a custom-triggered pipeline containing a normal step, and a deployment stage using step anchors : 

definitions:
  steps:
    - step: &deploy
        name: Deploy
        script:
          - echo "Deploying"
    - step: &restart-services
        name: Restart services
        script:
          - echo "Restarting services"

pipelines:
  custom:
    dev:
      - step:
          name: Build and test
          script:
            - echo "Building and testing"
      - stage:
          name: Deploy to test environment
          deployment: test
          steps:
            - step: *deploy
            - step: *restart-services

 You can find additional examples of using stages in our official documentation below : 

Also, while creating/editing your YML file, if you would like to validate if the syntax is correct before pushing it to the repository, I recommend using the Bitbucket Pipelines validator tool, so if there is any syntax error in the YML file you can catch it beforehand.

Hope that helps! Let me know in case you have any questions.

Thank you, @Vadym Polietaiev !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events