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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,455,327
Community Members
 
Community Events
175
Community Groups

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

Edited

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

pull-requests:
"**":
- variable:
NOT_TEST_STEP_COUNT: 2
- parallel:
…2 none test step
- step: *Test_1
- step: *Test_2
…40 other steps

"release/*":
- variable:
NOT_TEST_STEP_COUNT: 3
- 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
TAGS

Atlassian Community Events