Skip to content

fix(ci): prevent grep pipe from failing the diagnostics step#2170

Merged
gounthar merged 1 commit intojenkins-docs:mainfrom
gounthar:fix/plugin-update-grep-safeguard
Apr 21, 2026
Merged

fix(ci): prevent grep pipe from failing the diagnostics step#2170
gounthar merged 1 commit intojenkins-docs:mainfrom
gounthar:fix/plugin-update-grep-safeguard

Conversation

@gounthar
Copy link
Copy Markdown
Collaborator

Summary

The failure-diagnostics step added in #2169 had a subtle bug: grep controller | head -1 exits 1 when no matching container is found. Under bash's -e + pipefail, this aborts the step before it can print any output — the opposite of what the step is meant to do.

Changes

  • .github/workflows/plugin_update.yml: Replace grep controller | head -1 with grep -m1 controller || true in the Capture Jenkins logs on failure step so the step never fails due to missing containers.

Why it matters

This was reported on PR #2169 by the automated code reviewer. The if: failure() guard ensures the step only runs when something is already broken — having the diagnostic step itself fail silently would hide the root cause of the original failure.

grep exits 1 when no match is found. Under bash -e with pipefail, this
would abort the failure-capture step before it finishes, defeating its
purpose. Use grep -m1 with || true to ensure the step always succeeds.

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
@github-actions github-actions Bot added the repo label Apr 21, 2026
@gounthar gounthar merged commit a03ce76 into jenkins-docs:main Apr 21, 2026
5 of 7 checks passed
@gounthar gounthar deleted the fix/plugin-update-grep-safeguard branch April 21, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant