Skip to content

fix: report a clear error when chart-testing blob verification fails - #210

Merged
cpanato merged 1 commit into
helm:mainfrom
somaz94:fix/blob-verify-error
Sep 17, 2026
Merged

cpanato merged 1 commit into
helm:mainfrom
somaz94:fix/blob-verify-error

Conversation

@somaz94

@somaz94 somaz94 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Under set -o errexit, the retVal=$? check after cosign verify-blob was
unreachable: a non-zero cosign verify-blob aborts the script immediately, so
the intended "Unable to validate chart-testing version" message never fired. The
error branch also called log_error, which is not defined anywhere in ct.sh
(it would fail with command not found if it were ever reached).

This rewrites the check as if ! cosign verify-blob ...; then, which suspends
errexit for the tested command so the failure branch is actually reached, and
replaces the undefined log_error with echo "ERROR: ..." >&2, matching the
existing error style used in parse_command_line. Behavior on success is
unchanged; on verification failure the script now prints the intended clear
error and exits 1.

Validation:

  • bash -n ct.sh and zsh -n ct.sh parse clean
  • shellcheck ct.sh clean
  • Confirmed in both bash and zsh that if ! cmd reaches the failure branch under set -o errexit

Note: open PR #205 wraps this same block in a verify_blob toggle but copies the
broken retVal/log_error pattern verbatim, so this fix is complementary
regardless of merge order.

@somaz94
somaz94 marked this pull request as ready for review June 5, 2026 03:20
@somaz94

somaz94 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Kind ping 🙂 — this has been green and awaiting review for about 5 weeks now. Happy to rebase or address any feedback whenever a maintainer has a chance to take a look. Thanks for maintaining this project!

@somaz94

somaz94 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Open since June with no review. Is a clearer error on chart-testing blob verification failure something you would take? Happy to close if not, otherwise this is green and ready.

@cpanato

cpanato commented Sep 17, 2026

Copy link
Copy Markdown
Member

@somaz94 can you rebase?

@somaz94
somaz94 force-pushed the fix/blob-verify-error branch from 3e77678 to 34e97ae Compare September 17, 2026 08:04
@somaz94

somaz94 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@cpanato

Rebased onto the latest main

no conflicts, the diff is unchanged.

@cpanato cpanato left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 (summary)

Reviewed with two models (Opus 4.8 + Fable 5) plus manual verification, against 34e97ae. LGTM.

Confirmed both claims in the description: log_error is defined nowhere in the repo, and under set -o errexit the retVal=$? branch was unreachable, so the intended message never fired. Verified with a fake cosign on PATH that the new if ! cosign ... still aborts before tar -xzf for exit codes 1/2/127/130/255 on bash 3.2 and 5.3 — the verification gate is intact, and the success-path output is byte-identical to before. shellcheck/bash -n/zsh -n clean.

Thanks for the rebase, and sorry for the long wait on this one. The e2e workflow had never actually run on the previous head (only DCO), so it was never as green as it looked — it's running now.

One note for the record, not a change request for this PR: the failure exit code narrows from cosign's status to a constant 1. Nothing observes it (action.yml only distinguishes zero from non-zero), so it's fine as-is.

Separately, the review turned up a pre-existing issue that is not from this PR and is present on main today: mkdir -p "${cache_dir}" at ct.sh:91 runs before download/verify, so a cache dir left behind by a failed run makes every subsequent run skip cosign entirely and put an unverified binary on PATH. Reproducible on main and on this branch identically. Bounded on GitHub-hosted runners (fresh tool cache per job), but real on self-hosted/reused runners. Worth a separate issue — this PR actually makes that failure mode easier to notice, which is another reason to take it.

@cpanato
cpanato merged commit 390b66a into helm:main Sep 17, 2026
4 checks passed
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.

2 participants