circleci-public / continuation-orb Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
What changed from 0.5.0 to 1.0.0 ?
keep a changelog with breaking changes
No response
This continuation orb added the long-awaited support in monorepos where we have first step to evaluate "what to do", and the continue step to actually do it.
The next step to make this solution monorepos friendly is to allow nice integration with github "required" status so PRs would get green-go only if: (a) no workflows actually ran or (b) all workflows that ran actually succeeded.
The idea is that all statuses would be aggregated into a single status context in Github (since Github only allows to pre-configure the required context).
The easiest way to implement it first is to have the continue job configured to verify that all scheduled workflows actually passed and make the continuation workflow status the required one.
foo
area, which is dynamically translated into backend-build
workflow. Her PR required check is backend-build
bar
area, which is dynamically translated into frontend-build
workflow. Her PR required check is frontend-build
protos
area, which is dyanmically translated into protobuf-build
, backend-build
and frontend-build
workflows. His PR required checks are all three workflows.We can extend the continue
job with the following syntax:
jobs:
- continuation/continue:
configuration_path: ./cont-config.yml
propagate: true # waits for downstream builds and propagate their aggregated statuses
Another advanced option:
jobs:
- continuation/continue:
configuration_path: ./cont-config.yml
propagate_name_patterns: ["required-.*"] # waits for downstream workflows with name that matches one of the given patterns, and propagate their aggregated statuses
0.2.0
When invoking the command continue on an alpine instance it fail with /bin/sh: syntax error: unexpected redirection
Working in the same way as on any other linux distribution that use bash.
The issue is because of the syntax used in the continue.sh script.
I'm going to open a PR to fix the issue
When writing shell scripts directly within the command of a step within a generated script is does not work the same as it does in the parent. For example in the parent config.yml, I have a step when a set a variable and then echo it. The value of the variable is displayed. This does not happen within a generated config. I have linked below an example repo showcasing this.
Expect the same functionality that commands allow in parent configs to work in generated configs
Repo with an example of the issue: https://github.com/BECkvalentine/circle-ci-command-example/tree/main
0.2.0
We're trying to use this in our self hosted cci setup (3.3.1), however when we attempt to use
circleci_domain: circleci.ourdomain.com, we get the following error.
Error calling workflow: 'setup'
Error calling job: 'setup'
Error calling command: 'continuation/continue'
Unexpected argument(s): circleci_domain
It should find that parameter and use it.
I am generating a new CircleCI configuration file to give to this orb:
- continuation/continue:
configuration_path: ".circleci/continue_config.yml"
Unfortunately, sometimes there are simply no workflows that I'd want to continue into. For example, a PR that only updates README.md will not match any entries in my mapping for path-filtering-orb
. In this case CircleCI considers the continued build an error because there is nothing to do:
In this case the documentation says to close out:
- continuation/finish
These are two different steps - I'm not aware of how to conditionally call steps based on the output of a previous step!
It seems as though this orb should have a third command that can dynamically switch between 'continue' or 'finish' depending on a parameter.
Something like this could probably work, if nothing else:
- run:
command: echo 'export CONTINUATION_ACTION=continue' >> $BASH_ENV
- continuation/decide:
configuration_path: ".circleci/continue_config.yml"
action: $CONTINUATION_ACTION
I could also imagine there being a special check on the config on disk, for example if .circleci/continue_config.yml
is empty (zero bytes) then finish instead of continuing.
Executors are useful for parameterized execution environments that will be reused. As this executor is used exclusively within the continue job, it should not be necessary and can sometimes be confusing for users.
Instead, I would recommend setting the docker executor and image statically on the continue job, including the same tag parameter for the image version tag.
This orb currently contains a mandatory checkout step.
If the repository had already been checked out by a previous job, then this step is redundant.
I believe the orb's configuration should allow to skip this checkout
step.
For consistency, you could also consider adding an optional workspace_path
parameter to attach a workspace, similarly to how it's done in the path-filtering-orb.
Thank you.
I would like to be able to optionally use the continuation orb with when: on_fail
.
The use case I have in mind is to kick off a manual approval
override in the case of a failed job:
workflows:
approve_manual_override:
jobs:
- manual-step-if-jobs-failed:
type: approval
and/or kick off different downstream workflows depending if a particular job succeeded or failed.
I have this working in my codebase by copying the source of the orb as a command in my config.yml
but would love for this to be incorporated into the upstream orb!
New parameter:
when:
description: When to run the workflow ['on_fail', 'on_success']
type: string
default: 'on_success'
Usage:
steps:
- run:
when: << parameters.when >>
Currently few examples are provided and there is no example of how to use the parameters parameter. As the text states "can either be a JSON object containing parameters or file name" many users are likely to end up being tripped up as it is not an object you define, but rather a JSON string containing a object.
not
{"name":"John", "age":30, "car":null}
but instead
'{"name":"John", "age":30, "car":null}'
The continuation orb is not the only CircleCI API consumer. We have some jobs that monitor workflows, workarounds for mutex and other jobs that also perform API requests.
We noticed that on peak times the API calls may fail with error 429 (Too many request).
CircleCI support suggested to read the HEADER
We implemented the retry with backoff on our scripts but we rather that the official continuation orb would take care of that edge case on the official orb.
Thanks!
The checkout of the repo is taking too long while we need only one file
Add a step to clone the repo shallow, or just the file
No response
0.2.0
No actual workflow was triggered
We are expecting to see the workflow defined in build.yml
running.
A tag was pushed to our GitHub repo and triggered CircleCI setup workflow.
At the end of the setup, we have this step:
- continuation/continue:
configuration_path: .circleci/build.yml
parameters: /tmp/pipeline-parameters.json
and the actual runtime output was:
{
"continuation-key": "*********",
"configuration": "< the content of our build.yml >",
"parameters": < the content of our pipeline-parameters.json >
}
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21892 100 16 100 21876 166 222k --:--:-- --:--:-- --:--:-- 222k
{"message":"OK"}
CircleCI received exit code 0
This should switch from my 2nd party badge service to the official one.
continuation-orb/src/scripts/continue.sh
Line 47 in ce0abef
Currently, when a user tries to rerun a pipeline and the continuation key has expired, they get an unhelpful error message.
{"message":"Key has expired."}
Exited with code exit status 1
CircleCI received exit code 1
If you don't know the details of how dynamic configuration pipelines work, this message is meaningless. Could you update the API response to include a more helpful message or have the orb check the message and add more context/help?
0.2.0
I have a monorepo with the following config:
version: 2.1
setup: true
orbs:
continuation: circleci/[email protected]
jobs:
setup:
executor: continuation/default
steps:
- checkout
- run:
name: Determine the jobs to run
command: OUTPUT_PATH=/tmp/workspace .circleci/scripts/diff.sh
- persist_to_workspace:
root: /tmp/workspace
paths:
- pipeline-parameters.json
service1:
executor: continuation/default
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- continuation/continue:
configuration_path: .circleci/service1.yml
parameters: /tmp/workspace/pipeline-parameters.json
service2:
executor: continuation/default
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- continuation/continue:
configuration_path: .circleci/service2.yml
parameters: /tmp/workspace/pipeline-parameters.json
workflows:
build:
jobs:
- setup
- service1:
requires:
- setup
- service2:
requires:
- setup
setup
generates parameters to run on each of the two separate config.
Running service1
triggers a new pipeline as expected. Running service2
fails the continuation with {"message":"Pipeline is not in setup state."}
Starting a new separate pipeline for each service being continued.
As an example, in my current scenario .circleci/service1.yml
config file would be:
version: 2.1
parameters:
run-service1-build:
type: boolean
default: false
run-service2-build:
type: boolean
default: false
jobs:
test:
# ...
lint:
# ...
workflows:
test_and_lint:
when: << pipeline.parameters.run-service1-build >>
jobs:
- lint
- test
0.2.0
using the example (updating version to latest orb version) from https://circleci.com/developer/orbs/orb/circleci/continuation:
version: '2.1'
orbs:
continuation: circleci/[email protected]
workflows:
use-my-orb:
jobs:
- continuation/continue:
configuration_path: ./config.yml
results in message:
CIRCLE_CONTINUATION_KEY is required. Make sure setup workflows are enabled.
no errors
Additional Information:
Example should include setup: true
On behalf of the team @bionicstork:
When using dynamic configuration and the orb "circleci/continuation" the created config file has a size limit since the orb is passing the config using command line arguments and not files.
We fixed this by copying your code and changing it so it will split the config file, stringify the yaml and join all the parts back together.
CONFIG_PATH=<<parameters.configuration_path>>
PARAMETERS=<<parameters.parameters>>
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
PARAMS=$([ -f "$PARAMETERS" ] && cat "$PARAMETERS" || echo "$PARAMETERS")
if ! jq . >/dev/null 2>&1 \<<<"$PARAMS"; then
echo "PARAMETERS aren't valid json"
exit 1
fi
echo "{\"config\":\"" > final
split -l 1000 "$CONFIG_PATH" part
parts=$(ls | grep part)
for p in $parts
do
content=$(cat $p)
jq -n --stream \
--arg config "$content" \
'{"part": $config}' > jsoned
partStr=""
split -l 1 jsoned line
line=$(cat lineab)
line=${line:11}
line=$(echo "$line" | sed 's/.$//')
current=$(cat final)
echo "${current}\n${line}" > final
done
current=$(cat final)
echo "${current}\"}" > final
JSON_BODY=$( jq -n --stream \
--arg continuation "$CIRCLE_CONTINUATION_KEY" \
--slurpfile config final \
--arg params "$PARAMS" \
'{"continuation-key": $continuation, "configuration": $config[0].config, parameters: $params|fromjson}'
)
echo "$JSON_BODY" > json_body
cat 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 ]]
for the https://github.com/CircleCI-Public/continuation-orb/blob/master/src/scripts/continue.sh script.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.