Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix CI skip script hole #4323

Merged
merged 1 commit into from
Sep 17, 2024
Merged

Conversation

zalimeni
Copy link
Member

@zalimeni zalimeni commented Sep 16, 2024

In some environments, the script will not fail despite SKIP_CHECK_BRANCH being unset, leading to the script explicitly skipping CI when it should fail fast.

Prevent this by explicitly checking for the env var.

Also fix a small bug where we're incorrectly requiring ',' in the .changelog directory name, which means we'll never skip changelog entries.

This change is a port of hashicorp/consul#21741.

Testing

❯ ./.github/scripts/check_skip_ci.sh
./.github/scripts/check_skip_ci.sh: line 27: SKIP_CHECK_BRANCH: SKIP_CHECK_BRANCH is required

❯ export SKIP_CHECK_BRANCH=net-10843-cannot-add-tolerations-to-apigateway
❯ ./.github/scripts/check_skip_ci.sh
checking file: .changelog/4313.txt
checking file: .github/scripts/check_skip_ci.sh
checking file: .go-version
non-skippable file changed: .go-version
Changes detected in non-documentation files - will not skip tests and build

In some environments, the script will not fail despite SKIP_CHECK_BRANCH
being unset, leading to the script explicitly skipping CI when it should
fail fast.

Prevent this by explicitly checking for the env var.

Also fix a small bug where we're incorrectly requiring ',' in the
.changelog directory name, which means we'll never skip changelog
entries.

This change is a port of hashicorp/consul#21741.
@zalimeni zalimeni added backport/1.1.x Backport to release/1.1.x branch pr/no-changelog PR does not need a corresponding .changelog entry backport/1.3.x backport/1.4.x backport/1.5.x labels Sep 16, 2024
@@ -43,7 +44,7 @@ for file_to_check in "${files_to_check_array[@]}"; do
# - Markdown files
for dir in "${skipped_directories[@]}"; do
if [[ "$file_to_check" == */check_skip_ci.sh ]] ||
[[ "$file_to_check" == "$dir"* ]] ||
[[ "$file_to_check" == "$dir/"* ]] ||
Copy link
Member

Choose a reason for hiding this comment

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

nice catch

Copy link
Member

@jm96441n jm96441n left a comment

Choose a reason for hiding this comment

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

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.1.x Backport to release/1.1.x branch backport/1.3.x backport/1.4.x backport/1.5.x pr/no-changelog PR does not need a corresponding .changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants