Setting pipeline.parameters.workflow on git push

I have declared my parameters like so


parameters:
  workflow:
    type: enum
    enum: [build, terraform_import_resources]
    default: build
workflows:
  version: 2

  build:
    when:
     and:
      - equal: [ "", << pipeline.schedule.id >> ] # To run build workflow if the source is not a scheduled build.
      - equal: [ false, equal : [ terraform_import_resources, << pipeline.parameters.workflow >> ]]
terraform_import_resources:
    when: 
      equal: [ terraform_import_resources, << pipeline.parameters.workflow >> ]

Since the default workflow is build, whenever I do a git push, build will run. Is there a way to pass terraform_import_resources in pipeline.parameters.workflow when I do a git push so that this workflow will run?

There are 2 options

  • make use of whatever features there are available on the platform that you are hosting the repo to start the workflow via the API rather than the default webhook interface. Via the API you can provide values for the defined parameters.

  • read up on the Dynamic Configuration feature of CircleCI. This basically allows you to have one config.yml script file that is able to then call another one. This allows the first script to pull together all the dynamic info needed and then pass it to the second script as ‘static’ values. The starting points for this feature are

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.