The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Xiao Li
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 24, 2022

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Xiao Li
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 24, 2022

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.

TAGS
AUG Leaders

Atlassian Community Events