You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.