Skip to main content

How to pass a parameter when using the continuation orb

If you need to pass a parameter (and its associated value) from the Setup Workflow to the Continuation Workflow, you can leverage the `parameters` parameter of the continuation orb's `continue` command.

This is typically useful if you want the execution of the Continuation Workflow to depend on logic statements.

Prerequisites

This guide assumes that you have some familiarity with Dynamic Configuration.

Instructions

Below is an example of the config.yml for the Setup Workflow:

version: 2.1
setup: true
orbs:
 continuation: circleci/[email protected]:
  set-param:
    docker:
      - image: cimg/node:24.0.1  steps:
    - continuation/continue:
        parameters: '{ "further": true }'
        configuration_path: ./config_continue.ymlworkflows:
 use-my-orb:
   jobs:
     - set-param

Below is an example the continue.yml for the Continuation Workflow:

version: 2.1parameters:
  further:
    type: boolean
    default: falsejobs:
  module-build:
    docker:
      - image: cimg/node:24.0.1
  steps:
    - run:
        name: Check directory
        command: pwdworkflows:
  module-workflow:
    when: << pipeline.parameters.further >>
    jobs:
      - module-build

Outcome

In the above scenario, the module-workflow will only execute if you specified parameters: '{ "further": true }' when invoking the continuation/continue command.

Note the single quote encapsulating the full JSON object.

Additional Notes

You can pass several parameters when invoking the continuation/continue command; however they need to be part of the same JSON object. For example:

steps:
  - continuation/continue:
      parameters: '{ "further": true, "other_param": "a_string" }'
      configuration_path: ./config_continue.yml

(Note the absence of double-quotes around the boolean's value)

The parameters parameter accepts either a JSON object or a path to a file containing a JSON object. So the following is also valid:

steps:
  - run: echo '{ "further": true, "other_param": "a_string" }' > /home/circleci/parameters.json
  - continuation/continue:
      parameters: /home/circleci/parameters.json
      configuration_path: ./config_continue.yml
Did this answer your question?