Skip to content

build: add cosign 409 diagnostic message#2277

Draft
ideaship wants to merge 1 commit into
mainfrom
fix/cosign-rekor-409-diagnostic
Draft

build: add cosign 409 diagnostic message#2277
ideaship wants to merge 1 commit into
mainfrom
fix/cosign-rekor-409-diagnostic

Conversation

@ideaship
Copy link
Copy Markdown
Contributor

Summary

When cosign sign fails with HTTP 409 createLogEntryConflict, the raw Rekor error gives no indication of the cause or when it will self-resolve. This adds a diagnostic NOTE after the error that points to the upstream bug and explains that the next build will succeed.

Test plan

  • Verify CI passes on this branch
  • Confirm the wrapper does not affect the success path (no createLogEntryConflict → no change in output or exit code)
  • When the upstream bug is fixed in cosign, the wrapper can be removed

🤖 Generated with Claude Code

When cosign sign exits non-zero with a createLogEntryConflict HTTP
409 response, the raw error message from Rekor gives no indication
of why the retry will also fail or what to do next. This can happen
when Rekor accepts the signing bundle but the subsequent OCI .sig
push fails transiently; any retry of the full cosign sign command
then sees a duplicate Rekor entry and exits rc=1 permanently.

Wrap the cosign call so that on failure the output is checked for
the createLogEntryConflict string. When found, a NOTE is printed
that points to the upstream cosign bug and explains that the next
build will succeed because it produces a fresh image digest. The
build still fails with the original non-zero exit code; no
behaviour change for any other cosign error.

Upstream: sigstore/cosign#4711

AI-assisted: Claude Code
Signed-off-by: Roger Luethi <luethi@osism.tech>
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • This shell snippet now depends on Bash-specific features like PIPESTATUS and [[ ]]; if the Ansible task runs with /bin/sh or a non-Bash shell, consider explicitly setting executable: /bin/bash or rewriting to POSIX shell to avoid runtime errors.
  • The use of a hardcoded cosign-output.txt file may leave artifacts and could clash in reused workspaces; consider using a temporary file (e.g., via mktemp) and cleaning it up after use or capturing the output in a variable instead.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- This shell snippet now depends on Bash-specific features like PIPESTATUS and `[[ ]]`; if the Ansible task runs with `/bin/sh` or a non-Bash shell, consider explicitly setting `executable: /bin/bash` or rewriting to POSIX shell to avoid runtime errors.
- The use of a hardcoded `cosign-output.txt` file may leave artifacts and could clash in reused workspaces; consider using a temporary file (e.g., via `mktemp`) and cleaning it up after use or capturing the output in a variable instead.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ideaship ideaship marked this pull request as draft May 19, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

2 participants