Skip to content

Allow just one parallel job

Fred Cox requested to merge mcfedr/gitlab:parallel-one into master

This is a minor issue, but a also presumably a quick fix and would be helpful

whats wrong

cannot make a CI job like this

test:
  parallel: 1
  script:
       -jest --ci --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL

The linter will give the error

jobs:test:parallel config must be greater than or equal to 2

why is a problem

I want to make a job that is a template for a bunch of different test runs, in some of them I'd like to use parallel, but it doesnt always make sense

but because i want the script to be shared, it will always use the two variables $CI_NODE_INDEX, $CI_NODE_TOTAL. the docs say that CI_NODE_INDEX isnt set when parallel isnt used.

so for my script to work correctly I'd need to manually set a variable CI_NODE_INDEX=1

and if set parallel: 10 in the template, and extend it, i cannot set it back to 1 for some particular job

what would need to change

allow parallel: 1 in the linter, make one job, with CI_NODE_INDEX=1 and CI_NODE_TOTAL=1

fixes #408825

Merge request reports