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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to count parallel test steps under a parallel block in bitbucket yml?


I'd like to use the value of BITBUCKET_PARALLEL_STEP, and BITBUCKET_PARALLEL_STEP_COUNT to figure out how many tests each parallel step should run together with the filter flag of jest.

The challenge I have is that for default pull request "**", I have 3 other parallel steps. For pull requests starting with release/* I need to run 2 other parallel steps. As a result, trying to figure out how many total parallel steps there are for running tests get a bit tricky inside the steps.

What I want to do

- variable:
- parallel:
…2 none test step
- step: *Test_1
- step: *Test_2
…40 other steps

- variable:
- parallel:
…3 none test step
- step: *Test_1
- step: *Test_2
…40 other steps

Inside test steps, I use npm with a filter file to decide how many tests to run dynamically inside test steps as I might increase test steps to reduce time it takes to run all 3000 tests we have.

I pushed this code up and bitbucket pipeline complains it's not valid. Can't I use variable here?


I then thought of using nested parellel, but the validator doesn't like it either. 

- parellel:
  - parallel:
    - step
  - parallel:
    - step


Apart from adding a sequential step that generates a file that I can source in later steps, is there a simple way to count total number of test steps inside a step in my use case?

1 answer

I ended up moving all test steps to the top of the parallel group and export a TEST_STEP_COUNT variable instead. This way, my jest filter assumes test steps begin at index 0 within the parallel group, and knows the total test step count from the environment variable I exported.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events