How to pass a parameter when using the continuation orb

Within your config you may need to pass a parameter that needs to be set within your continued config file when using the continuation orb. You can do this by setting a pipeline parameter that passes the value. 

Prerequisites

This guide assumes that you have some familiarity with the continuation orb linked here.

Instructions

You will need two configs the first is the setup config and the second is the continuation config in this case named ./config_continue.yml

The following is an example config.yml 

version: 2.1
setup: true
orbs:
continuation: circleci/continuation@0.3.1

parameters:
workingdir:
description: Some string to pass
type: string
default: "/home/circleci"

workflows:
use-my-orb:
jobs:
- continuation/continue:
configuration_path: ./config_continue.yml

The setup: true has to be set for the continuation orb to work as well as the Enable dynamic config using setup workflows setting within the project settings under the Advanced section.

You will also need to define the parameter that you would like to pass within the config or it will not be passed over to the continuation orb.

The following is an example of the config_continue.yml which is referenced above

version: 2.1

parameters:
workingdir:
description: Some string to pass
type: string
default: "/home/circleci"

jobs:
module-a-build:
docker:
- image: cimg/node:19.6.1
steps:
- run:
name: Check directory
command: pwd
working_directory: << pipeline.parameters.workingdir >>

workflows:
module-a-workflow:
jobs:
- module-a-build

Once again you will need to define the same parameter with the same name.

Outcome

Once both of these files have been set you can now run a build where you define the parameter workingdir this can be triggered by either passing the parameter using the API or using the trigger pipeline button.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.