Missed Team ’24? Catch up on announcements here.

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

How to create a 'n' no of parallel step based on user input ?

oboe_ada May 1, 2023

i have one parameter called number_of_org that is used to create n number of scratch org parallely .how based on the user input for eg:if 4 i want to create run commands that create 4 scratch parallely .
so , i want to create n no of step that run parallely?

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2023

Hello @oboe_ada ,

Welcome to the Atlassian Community!

My understanding of your requirement is that you would like to programmatically generate pipelines parallel steps based on the user input. I'm afraid this is not currently possible in Bitbucket Pipelines.

One option, in case you need to repeat sections of your yml file, is to use YML anchors. With anchors, you can define a "template" of the step and can re-use it multiple times in the rest of your YML file : 

definitions: 
  steps:
    - step: &build-test
        name: Build and test
        script:
          - mvn package
        artifacts:
          - target/**
 
pipelines:
  branches:
    develop:
      - step: *build-test
    main:
      - step: *build-test

 In the example above we are defining an anchor step named build-test which acts like the "template", and then we can reference it in the pipeline definition multiple times without having to repeat the entire step's code.

For more details about how to use anchors, you can refer to our documentation YAML Anchor - Bitbucket Pipelines.

Thank you, @oboe_ada !
Patrik S

oboe_ada May 3, 2023

Thank you @Patrik S 

Like Patrik S likes this

Suggest an answer

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

Atlassian Community Events