CircleCI Ideas

parameterizable workflows

Our current build and tests are supporting different versions of python and using different options for our tests. Since tests are parameterizable I was able to minimize code in a very great fashion. The last part to keep it DRY would be to parameterize my workflows since I am using the exactly same workflow only once with executor python 3.7 and executor python 3.6. I would like to pass this parameter to a workflow to not duplicate the whole job sequence for both. It could look something like this:

 

workflow-template:
generic-build-and-test:
parameters:
py-version:
description: "python version to be used in the executor"
default: latest
type: string
jobs:
- build:
python: << parameters.py-version >> # (you could also pass eecutor type)
- test:
python: << parameters.py-version >> # (you could also pass eecutor type)
#and then

workflows:
generic-build-and-test:
name: build-and-test-3.6
py-version: "3.6"

generic-build-and-test:
name: build-and-test-3.7
py-version: "3.7"

 

In this example I followed the idea of jobs, how to use multiple jobs in the same workflow, also how to distinguish between them and ported this to workflows. 

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Oct 31 2018
  • New
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    November 05, 2019 16:06

    This would also help us tremendously, but as with any useful-sounding CircleCI idea, this entry is just a graveyard with zero engagement from CircleCI folks.