1. circleci/continuation@0.1.2

circleci/continuation@0.1.2

Certified
Sections
Make continuing setup workflows easy.
Created: February 12, 2021Version Published: March 11, 2021Releases: 13
Org Usage:
1401

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: continuation: circleci/continuation@0.1.2

Use continuation elements in your existing workflows and jobs.

Usage Examples

example

Example configuration

1 2 3 4 5 6 7 8 version: '2.1' orbs: continuation: circleci/continuation@1.2.3 workflows: use-my-orb: jobs: - continuation/continue: configuration_path: ./config.yml

Jobs

continue

Make a request to the API to continue the pipeline.

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
configuration_path
The path to the configuration that will be passed to the continue API
Yes
-
string
parameters
The parameters used for the pipeline. This can either be a JSON object containing parameters or a path to a file containing a JSON object with parameters
No
'{}'
string

Commands

continue

Makes a post request to https://circleci.com/api/v2/pipeline/continue to continue a setup workflow.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
configuration_path
The path to the configuration that will be passed to the continue API
Yes
-
string
parameters
The parameters used for the pipeline. This can either be a JSON object containing parameters or a path to a file containing a JSON object with parameters
No
'{}'
string

finish

Makes a post request to https://circleci.com/api/v2/pipeline/continue with an empty config to advance the pipeline, but not execute any further workflows, preventing other continuations.

Show command Source

Executors

default

The executor for continuations

Show executor Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
tag
Pick a specific circleci/base image variant: https://hub.docker.com/r/cimg/base/tags
No
stable
string

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: | Make continuing setup workflows easy. display: home_url: https://github.com/CircleCI-Public/continuation-orb/ source_url: https://github.com/CircleCI-Public/continuation-orb/ commands: continue: description: | Makes a post request to https://circleci.com/api/v2/pipeline/continue to continue a setup workflow. parameters: configuration_path: description: The path to the configuration that will be passed to the continue API type: string parameters: default: '{}' description: The parameters used for the pipeline. This can either be a JSON object containing parameters or a path to a file containing a JSON object with parameters type: string steps: - run: command: | if [ -z "${CIRCLE_CONTINUATION_KEY}" ]; then echo "CIRCLE_CONTINUATION_KEY is required. Make sure setup workflows are enabled." exit 1 fi if [ -z "${CONFIG_PATH}" ]; then echo "CONFIG_PATH is required." exit 1 fi if ! which curl > /dev/null; then echo "curl is required to use this command" exit 1 fi if ! which jq > /dev/null; then echo "jq is required to use this command" exit 1 fi PARAMS=$([ -f "$PARAMETERS" ] && cat "$PARAMETERS" || echo "$PARAMETERS") if ! jq . >/dev/null 2>&1 \<<<"$PARAMS"; then echo "PARAMETERS aren't valid json" exit 1 fi mkdir -p /tmp/circleci rm -rf /tmp/circleci/continue_post.json # Escape the config as a JSON string. jq -Rs '.' "$CONFIG_PATH" > /tmp/circleci/config-string.json jq -n \ --arg continuation "$CIRCLE_CONTINUATION_KEY" \ --arg params "$PARAMS" \ --slurpfile config /tmp/circleci/config-string.json \ '{"continuation-key": $continuation, "configuration": $config|join("\n"), "parameters": $params|fromjson}' > /tmp/circleci/continue_post.json cat /tmp/circleci/continue_post.json [[ $(curl \ -o /dev/stderr \ -w '%{http_code}' \ -XPOST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ --data @/tmp/circleci/continue_post.json \ "https://circleci.com/api/v2/pipeline/continue") \ -eq 200 ]] environment: CONFIG_PATH: <<parameters.configuration_path>> PARAMETERS: <<parameters.parameters>> name: Continue Pipeline finish: description: | Makes a post request to https://circleci.com/api/v2/pipeline/continue with an empty config to advance the pipeline, but not execute any further workflows, preventing other continuations. steps: - run: command: | if ! which curl > /dev/null; then echo "curl is required to use this command" exit 1 fi if ! which jq > /dev/null; then echo "jq is required to use this command" exit 1 fi JSON_BODY=$( jq -n \ --arg continuation "$CIRCLE_CONTINUATION_KEY" \ '{"continuation-key": $continuation, "configuration": "{version: 2, jobs: {}, workflows: {version: 2}}", parameters: {}}' ) echo "$JSON_BODY" [[ $(curl \ -o /dev/stderr \ -w '%{http_code}' \ -XPOST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ --data "${JSON_BODY}" \ "https://circleci.com/api/v2/pipeline/continue") \ -eq 200 ]] name: Finish Pipeline executors: default: description: | The executor for continuations docker: - image: cimg/base:<<parameters.tag>> parameters: tag: default: stable description: | Pick a specific circleci/base image variant: https://hub.docker.com/r/cimg/base/tags type: string jobs: continue: description: | Make a request to the API to continue the pipeline. executor: default parameters: configuration_path: description: The path to the configuration that will be passed to the continue API type: string parameters: default: '{}' description: The parameters used for the pipeline. This can either be a JSON object containing parameters or a path to a file containing a JSON object with parameters type: string steps: - continue: configuration_path: << parameters.configuration_path >> parameters: << parameters.parameters >> examples: example: description: | Example configuration usage: version: "2.1" orbs: continuation: circleci/continuation@1.2.3 workflows: use-my-orb: jobs: - continuation/continue: configuration_path: ./config.yml
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.