Repository navigation
ci: retry the deployment check's notification - #130
Conversation
The deployment check failed intermittently with a failed notification of the sidecar, 30-40 ms after the subscription and about 0.1 s after the sidecar's EndpointSlice became ready: too fast for a timeout, so the connection was refused, as the node's proxy didn't route the new Service yet. Pubgrade notifies only once. check.sh now publishes once more, after 5 s, when the notification got no answer, and prints the HTTP status of the sidecar's answer (also in the error). check-local.sh prints Pubgrade's log lines about notifications when the check fails. Closes #129 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideDocumentationDocument when the deployment check retries and how it reports the sidecar’s HTTP status.
TestsReview the deployment check’s retry and HTTP-status reporting together: it republishes after no response or a 5xx, then reports the final notification result.
Review the local check’s failure diagnostics, which print Pubgrade notification logs with a timeout before cleanup.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #130 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 18 18
Lines 1748 1748
=========================================
Hits 1748 1748 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit 689ef5d #129 ci: make the deployment check reliable · 2 of 3 met · 1 to check by hand
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/e2e/check-local.sh" line_range="26-27" />
<code_context>
+ # Pubgrade logs why a notification failed (the error's type only)
+ if [ "${status}" -ne 0 ]; then
+ echo "Pubgrade's log of notifications:" >&2
+ k logs --namespace pubgrade deployment/pubgrade --tail=500 2>&1 \
+ | grep -i notif >&2 || true
+ fi
cluster_down
</code_context>
<issue_to_address>
**Failure cleanup can hang**
When the check exits unsuccessfully while the local cluster API is stalled or unreachable, the `kubectl logs` request has no request timeout, so a stalled connection to the cluster API blocks the EXIT trap before it reaches `cluster_down` or removes the kubeconfig; the CI job remains stuck until its outer timeout.
Give the log request a finite timeout and ensure cleanup runs even if fetching the logs stalls.
</issue_to_address>
### Comment 2
<location path="tests/e2e/check.sh" line_range="361" />
<code_context>
+# A Service whose EndpointSlice is ready may still refuse connections for a
+# moment, until each node's proxy routes it; Pubgrade then gets no answer and
+# notifies only once. So without an answer, publish once more, a bit later
+if [ "${result}" = failed ] && [ "${http_status}" = none ]; then
+ log "Pubgrade's notification of ${callback_url} got no answer (build" \
+ "${build_id}); publishing again in 5 s"
</code_context>
<issue_to_address>
**Retry other notification failures**
The issue asks to retry once if the notification failed. The check retries only when there is no HTTP answer, so a failed notification with an HTTP status is not retried.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and when the first notification fails without an HTTP response, the check publishes a second build, which can leave another build record and trigger a duplicate sidecar notification or rollout. Reverting stops future retries but does not undo a build or notification already sent; these effects are bounded to the test deployment flow.
Blocking findings: tests/e2e/check-local.sh:27, tests/e2e/check.sh:361
The deployment check now also publishes once more when the sidecar answers with a 5xx status, e.g. while it can't reach the Kubernetes API; other statuses still fail at once. check-local.sh limits its request for Pubgrade's log to 30 s, so that a stalled cluster doesn't hold up the cleanup. From Sourcery's review. Refs #129 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge after the 0.3.0 tag (tag planned at dd26ee4); this PR must not go into the release commit.
Summary
Fixes the intermittent "Deployment check" failures.
Cause, from the logs of the three failed runs (44233103907, 44268355355 and 44271289988, first attempts): the notification failed 30-40 ms after the subscription was created, and about 0.1 s after the sidecar's EndpointSlice was ready. That is far too fast for Pubgrade's 10 s notification timeout, so Pubgrade got no answer at all: the connection was refused because the node's proxy didn't route the new Service yet (a Service without ready endpoints gets a reject rule until the proxy syncs). In the passing re-runs, the same step happened 0.06-0.7 s later. Pubgrade notifies only once, so the check failed.
Fix:
tests/e2e/check.sh: if the notification failed without an HTTP answer or with a 5xx status, wait 5 s and publish once more (a second build of the same tag; the cleanup removes the repository with its builds). Other statuses (e.g. a 401 from the sidecar) still fail at once. The HTTP status of the sidecar's answer is printed in the OK line and in the error.tests/e2e/check-local.sh(used by the CI job): when the check fails, prints Pubgrade's log lines about notifications (request limited to 30 s), which name the error type (e.g.ConnectionError), for the next diagnosis.docs/deployment.md: documents the retry and the printed status.No app code changes; the CI job itself is unchanged.
Light lane: CI/test scripts and docs only, no secrets, permissions or release workflow touched; I reviewed the diff myself instead of running the reviewer subagents.
Verification
shellcheck tests/e2e/*.sh(0.11.0): no findings in the changed scripts (only the existing SC2119 info notes incheck-local.shandupgrade.sh).bash -n tests/e2e/check.sh,git diff --check: clean.tests/e2e/check-local.shwithCHECK_CALLBACK_URL=http://127.0.0.1:9/deployment, which refuses connections): the check printed "got no answer ... publishing again in 5 s", published a second build, failed with "failed, HTTP status none", cleaned up everything and exited 1; check-local.sh printed Pubgrade's two log lines "Notifying subscription ... failed: ConnectionError".Declined review findings
Open questions
None.
Closes #129
🤖 Generated with Claude Code