Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

CI: Add ability to skip CI run in fast-return script #2915

Merged

Conversation

jodh-intel
Copy link
Contributor

Allow the CI to be skipped if the magic force-skip-ci label is set for a PR.

Added test for new function.

Fixes: #2914.

Signed-off-by: James O. D. Hunt james.o.hunt@intel.com

Optimise `install_jq()` to return immediately if `jq(1)` is already
available, which can speed up the function significantly.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Refactor to simplify `check_force_label()`. That function now calls a
generic `check_label()` function, which in turn calls `is_label_set()`
to handle the GitHub API call.

Added tests for new functions.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Allow the CI to be skipped if the magic `force-skip-ci` label is set for
a PR.

Added test for new function.

Fixes: kata-containers#2914.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
@jodh-intel
Copy link
Contributor Author

fwiw, the force-ci label didn't exist in any of the repos. I've now added that label and force-skip-ci to enable both features.

@jodh-intel jodh-intel added needs-forward-port Changes need to be applied to a newer branch / repository needs-backport Changes need to be applied to an older branch / repository labels Oct 2, 2020
@jodh-intel
Copy link
Contributor Author

Even if this passes all the CI checks and gets approved, let's not land this until Monday "just in case" ;-) Note the new tests, plus I have tested the functionality on a real repo, but... Warsaw's Second Law 😄

@jodh-intel
Copy link
Contributor Author

Note the description of the force-skip-ci label y'all:

Stop the CI running for a PR (remember: if you break it, you fix it!)

@jodh-intel
Copy link
Contributor Author

/test

Copy link
Contributor

@wainersm wainersm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jodh-intel I really tried to find any problem, but I didn't :)


install_jq
local_info "label '$label' not found"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wainersm - is this the line you meant? This is correct because is_label_set() "returns" 1 if the label is found. I've quoted returns because all the functions actually return zero but echo a string to stdout as the actual return value. That was the original design to work within the confines of set -e so I've retained that to keep the diff minimal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @jodh-intel - I made a comment about that line but later and quickly I noticed I said something wrong. I deleted the comment, so never mind. You change looks good to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-backport Changes need to be applied to an older branch / repository needs-forward-port Changes need to be applied to a newer branch / repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI: Add ability to skip CI if magic label set
3 participants