CircleCI Ideas

Pass integer as parameters to make parallelism parameterizable

I tried to use the new feature introduced in V2.1 to use one job multiple times in a workflow. In order to empower this feature even more I tried to use a test pattern job on multiple tests. Some can be optimized by using  a certain degree of parallelism others don't. I wasn't able to use the parameter feature for that since you cannot pass integer values through parameters and parallelism requires integer. I also tried to convert the string to an integer which gave me a valid config.yaml but got stuck executing the job.

This makes the feature unusable for me and i can not keep it DRY. 

 

test:
parameters:
parallelism:
description: "number of containers to be used in parallel for this test"
default: "1"
type: string

parallelism: << parameters.parallelism >> #needs integer here

steps:
- attach_workspace:
at: "~"
- run:
circleci tests split | your test commands
workflows:
run-tests:
jobs:
- test:
name: test-with-high-parallelism
parallelism: "4"
- test:
name: test-with-no-parallelis
parallelism: "1"
  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Oct 26 2018
  • Shipped
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    October 26, 2018 23:01

    This is actually something we just shipped yesterday and haven't yet documented. You should be able to specify a parameter type of `integer` for this exact purpose.