Repository navigation
fix(build): add jitter and delay cap to cosign retry backoff - #598
Conversation
Raise cosign_max_attempts default from 3 to 5, cap the exponential backoff at cosign_max_delay (default 60s), and randomize it (equal jitter) to avoid thundering-herd retries against Rekor. Closes #450
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
Summary by CodeRabbit
WalkthroughThe cosign action now supports capped equal-jitter exponential retries, defaults to five attempts, and exposes a 60-second delay cap. The reusable build workflow forwards this setting, and related documentation describes the updated retry policy. ChangesCosign retry resilience
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🛡️ CodeQL Analysis ResultsLanguages analyzed: Found 1 issue(s): 1 Medium
🔍 View full scan logs | 🛡️ Security tab |
🔍 PR Validation Summary✅ PR Mergeable — no blocking failures
|
🔍 Lint Analysis
|
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/security/cosign-sign/action.yml`:
- Around line 24-27: Validate max-attempts, initial-delay, and max-delay as
non-negative integers before entering the retry loop, rejecting invalid values
before they reach seq, -gt, or arithmetic expressions. Update the input-handling
logic associated with the action’s retry configuration while preserving the
existing defaults and backoff behavior for valid values.
- Around line 17-19: Revert the retry defaults from 5 to 3 in both caller-facing
locations: src/security/cosign-sign/action.yml lines 17-19 and
.github/workflows/build.yml lines 159-161. Update the default associated with
the cosign signing retry configuration at each site; no other retry behavior
changes are needed.
- Around line 115-123: Update the retry backoff logic near capped_delay so the
persistent delay value cannot exceed MAX_DELAY before the next iteration. After
calculating the next delay, clamp delay to MAX_DELAY or skip multiplication when
it would exceed the ceiling, while preserving the existing capped sleep and
jitter behavior.
In `@src/security/cosign-sign/README.md`:
- Line 89: The configuration examples must demonstrate the new delay-cap
overrides: update src/security/cosign-sign/README.md lines 89-89 to include
max-delay in the action example, and docs/build-workflow.md lines 285-285 to
include cosign_max_delay in the workflow example.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 474d8e8c-928c-4ab3-bc65-223914d2a698
📒 Files selected for processing (4)
.github/workflows/build.ymldocs/build-workflow.mdsrc/security/cosign-sign/README.mdsrc/security/cosign-sign/action.yml
Clamp the persistent delay variable to max-delay (not just the sleep value) to avoid unbounded growth across retries, and add max-delay to the README/docs configuration examples.
Description
Adds jitter and a delay cap to the cosign signing retry policy, and raises the default max attempts, to better absorb Rekor outages that can last several minutes.
The 2.2.0-beta.6 release incident showed the current retry policy is insufficient: attempt #1 failed because
cosign signhit a transient Rekor404 getLogEntryByUuidNotFoundacross all 3 retry attempts.Changes:
src/security/cosign-sign/action.yml:max-attemptsdefault raised from3to5; newmax-delayinput (default60s) caps the exponential backoff; retry delay is now randomized with equal jitter (half fixed + half random) to avoid multiple concurrent jobs retrying against Rekor at the same instant..github/workflows/build.yml:cosign_max_attemptsdefault raised to5; newcosign_max_delayinput (default60) wired through to the composite action.src/security/cosign-sign/README.mdanddocs/build-workflow.md: updated to document the new defaults, the cap, and the jitter behavior.Type of Change
fix: Bug fix in a workflow (incorrect behavior, broken step, wrong condition)Breaking Changes
None. Defaults only get more resilient (more attempts, capped/jittered backoff);
initial-delay/cosign_initial_delayare unchanged at5s.Testing
@this-branchor the beta tagRelated Issues
Closes #450