Skip to content

ci: retry the deployment check's notification - #130

Merged
uniqueg merged 2 commits into
devfrom
ci/129-deployment-check-retry
Nov 19, 2026
Merged

uniqueg merged 2 commits into
devfrom
ci/129-deployment-check-retry

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

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 in check-local.sh and upgrade.sh).
  • bash -n tests/e2e/check.sh, git diff --check: clean.
  • Retry path, locally at 29a5a70 (tests/e2e/check-local.sh with CHECK_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".
  • CI run 44274537314: all checks green. The Deployment check passed in attempt 1 and in 3 re-runs (attempts 2-4, jobs 134701567737, 134702719459, 134703882361), each with "the sidecar accepted it (HTTP status 202)" on the first publish; the race didn't occur in these runs, so the retry wasn't needed there.

Declined review findings

  • Sourcery: "retry other notification failures": taken for 5xx answers; not for 4xx (wrong token or URL), which a retry can't change and would only delay the error.

Open questions

None.

Closes #129

🤖 Generated with Claude Code

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]>
@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Documentation

Document when the deployment check retries and how it reports the sidecar’s HTTP status.

  • docs/deployment.md L416-419

Tests

Review the deployment check’s retry and HTTP-status reporting together: it republishes after no response or a 5xx, then reports the final notification result.

  • tests/e2e/check.sh L340-376

Review the local check’s failure diagnostics, which print Pubgrade notification logs with a timeout before cleanup.

  • tests/e2e/check-local.sh L22-30

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

read-the-docs-community Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 Pubgrade | 🛠️ Build #35980062 | 📁 Comparing 689ef5d against latest (dd26ee4)

  🔍 Preview build  

1 file changed
± deployment/index.html

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (dd26ee4) to head (689ef5d).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 18, 2026 09:29
@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit 689ef5d

#129 ci: make the deployment check reliable · 2 of 3 met · 1 to check by hand

# Requirement Status Notes
1 Find out whether readiness or the notification response/error causes the failure. ✅ Met The check reports the notification HTTP status, and check-local.sh prints Pubgrade notification log lines that identify the error type; the check also waits for ready sidecar endpoints before publishing.
2 Wait for the sidecar's endpoints before publishing, or retry the publish once if the notification failed. ✅ Met The check waits for ready EndpointSlice addresses and retries once after no response or a 5xx notification status.
3 Know and fix the cause so the deployment check stops failing intermittently. 👀 Check by hand (runtime) Verify in subsequent Deployment check runs that the identified service-routing race no longer causes intermittent failures.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/e2e/check-local.sh Resolved
Comment thread tests/e2e/check.sh Resolved
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]>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@uniqueg
uniqueg merged commit e16752e into dev Nov 19, 2026
52 checks passed
@uniqueg
uniqueg deleted the ci/129-deployment-check-retry branch November 19, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: make the deployment check reliable

1 participant