From 8f341b3765f05400ddc9f568aed6049143bd2bb1 Mon Sep 17 00:00:00 2001 From: Diego Braga Date: Wed, 2 Dec 2026 23:52:20 +0100 Subject: [PATCH 1/3] test(clickstack-upgrade): wait for the dashboard in HyperDX, not a Created line in the new pod Gate run 46986599979 failed the 7f9537a1ba03 baseline waiting 420 s for "Created provisioned dashboard" in the new HyperDX pod. That baseline already ran the same provisioner, and the team is registered seconds before the upgrade, so the old pod (serving for about two minutes while the new one starts) can create the dashboard in a tick of its own; the new pod then has nothing to create and logs no such line. The same leg passed an hour earlier when the old pod's tick missed. The wait now keys on the dashboard existing in HyperDX, then deletes it and requires THIS pod to create it again within one provisioner tick plus slack, which proves the new pod's watcher and provisioner whoever created it first. On a timeout the suite prints both containers' logs. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_016RAxvm3ReSNJ4Vzepck9JT --- tests/clickstack-upgrade-kind.py | 50 +++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/tests/clickstack-upgrade-kind.py b/tests/clickstack-upgrade-kind.py index 0a17114..7b850a5 100644 --- a/tests/clickstack-upgrade-kind.py +++ b/tests/clickstack-upgrade-kind.py @@ -1340,10 +1340,52 @@ def main(): "apiVersion": "v1", "kind": "ConfigMap", "metadata": {"name": "e2e-dashboard", "namespace": NS, "labels": {"hyperdx.io/dashboard": "true"}}, "data": {"e2e-provisioned.json": json.dumps({"name": "e2e-provisioned", "tiles": [], "tags": ["e2e"]})}})) - # The sidecar syncs first, then the provisioner's minute tick writes the dashboard; then a further - # minute and a half so a ConfigMap it was going to read would have been. - wait("the provisioner to write the dashboard", - lambda: "Created provisioned dashboard" in kube.kn("logs", name, "-c", "app").stdout, timeout=420, every=10) + # The real condition is the dashboard in HyperDX, not a log line in THIS pod: the old release + # (0.1.67 on) ran the same provisioner, and the team is registered seconds before the upgrade, so + # the old pod, still serving while the new one starts (about two minutes), can create the dashboard + # in a tick of its own, and the new pod then has nothing to "Create". (Run 46986599979 waited + # 420 s for a "Created" line that this pod was never going to log.) So: wait for the dashboard to + # exist (bound: watcher sync + one minute tick + slack, with the pod already Ready); delete it; and + # require THIS pod to create it again, within one tick + the same slack. That proves this pod's + # watcher and provisioner whoever created it first. + def dump(why): + print(f" {why}: diagnostics") + for c in ("app", "dashboard-watcher"): + r = kube.kn("logs", name, "-c", c, check_=False) + lines = (r.stdout or r.stderr).splitlines() + print(f" {c} log, {len(lines)} lines, last 60:") + for l in lines[-60:]: + print(f" | {l[:300]}") + print(f" pod {name} started {p['status'].get('startTime')}, now {time.strftime('%H:%M:%S', time.gmtime())}Z") + + hxp = HyperDX(kube, email, password) + try: + hxp.register_or_login(register=False) + + def slo_dashboards(): + st, ds = hxp.v2("GET", "/dashboards", key=key) + return [d for d in ds if d["name"] == "CMP performance SLOs"] if st == 200 else False + + try: + wait("the dashboard CMP performance SLOs to exist in HyperDX", slo_dashboards, timeout=240, every=10) + except SystemExit: + dump("the dashboard never appeared") + raise + created_before = kube.kn("logs", name, "-c", "app").stdout.count("Created provisioned dashboard for CMP performance SLOs") + print(f" the dashboard exists; this pod has logged Created {created_before} time(s) so far") + for d in slo_dashboards(): + st, _ = hxp.v2("DELETE", f"/dashboards/{d['id']}", key=key) + check(st in (200, 204), f"deleted the provisioned dashboard {d['id']} (HTTP {st})") + try: + wait("this pod's provisioner to create the deleted dashboard again", + lambda: kube.kn("logs", name, "-c", "app").stdout.count( + "Created provisioned dashboard for CMP performance SLOs") > created_before and slo_dashboards(), + timeout=150, every=5) + except SystemExit: + dump("the provisioner did not re-create the dashboard") + raise + finally: + hxp.close() time.sleep(90) log = kube.kn("logs", name, "-c", "app").stdout check("Created provisioned dashboard" in log and "CMP performance SLOs" in log, From 38439b830bc8a4f93ef998ae5afbd9bb7aa3d074 Mon Sep 17 00:00:00 2001 From: Diego Braga Date: Thu, 3 Dec 2026 00:01:42 +0100 Subject: [PATCH 2/3] test(clickstack-upgrade): count the provisioner's Created lines by name and message The provisioner logs the dashboard name as a field, so the count must match the message and the name on the same line. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_016RAxvm3ReSNJ4Vzepck9JT --- tests/clickstack-upgrade-kind.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/clickstack-upgrade-kind.py b/tests/clickstack-upgrade-kind.py index 7b850a5..61a4016 100644 --- a/tests/clickstack-upgrade-kind.py +++ b/tests/clickstack-upgrade-kind.py @@ -1371,15 +1371,19 @@ def slo_dashboards(): except SystemExit: dump("the dashboard never appeared") raise - created_before = kube.kn("logs", name, "-c", "app").stdout.count("Created provisioned dashboard for CMP performance SLOs") + def created_lines(): + # pino logs {"name":"CMP performance SLOs","msg":"Created provisioned dashboard"} + return sum(1 for l in kube.kn("logs", name, "-c", "app").stdout.splitlines() + if "Created provisioned dashboard" in l and "CMP performance SLOs" in l) + + created_before = created_lines() print(f" the dashboard exists; this pod has logged Created {created_before} time(s) so far") for d in slo_dashboards(): st, _ = hxp.v2("DELETE", f"/dashboards/{d['id']}", key=key) check(st in (200, 204), f"deleted the provisioned dashboard {d['id']} (HTTP {st})") try: wait("this pod's provisioner to create the deleted dashboard again", - lambda: kube.kn("logs", name, "-c", "app").stdout.count( - "Created provisioned dashboard for CMP performance SLOs") > created_before and slo_dashboards(), + lambda: created_lines() > created_before and slo_dashboards(), timeout=150, every=5) except SystemExit: dump("the provisioner did not re-create the dashboard") @@ -1388,8 +1392,7 @@ def slo_dashboards(): hxp.close() time.sleep(90) log = kube.kn("logs", name, "-c", "app").stdout - check("Created provisioned dashboard" in log and "CMP performance SLOs" in log, - "the provisioner logged Created provisioned dashboard for CMP performance SLOs") + check(created_lines() >= 1, "the provisioner logged Created provisioned dashboard for CMP performance SLOs") check("Skipping invalid dashboard file" not in log, "and skipped no dashboard file as invalid") ps = kube.kn("exec", name, "-c", "app", "--", "sh", "-c", "ps -eo args 2>/dev/null || ps").stdout check("provision-dashboards" in ps, "the provision-dashboards process runs") From 34b4f9cdec669388123eca07c9a3b58a388062bc Mon Sep 17 00:00:00 2001 From: Diego Braga Date: Thu, 3 Dec 2026 00:08:41 +0100 Subject: [PATCH 3/3] ci(preflight): retry a registry lookup that got no HTTP answer HTTP 0 (no response), 429 and 5xx are retried with a short backoff, and so is the ghcr token request; 401 and 404 are answers about the reference and fail on the first try. A single dropped connection to ghcr failed a PR's preflight on an unrelated change. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_016RAxvm3ReSNJ4Vzepck9JT --- hack/preflight-refs.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/hack/preflight-refs.py b/hack/preflight-refs.py index 701b549..2ca8685 100755 --- a/hack/preflight-refs.py +++ b/hack/preflight-refs.py @@ -17,7 +17,7 @@ Exit 1 if any reference is unresolvable. """ -import base64, json, os, re, sys, urllib.error, urllib.request +import base64, json, os, re, sys, time, urllib.error, urllib.request import yaml @@ -52,14 +52,33 @@ def is_placeholder_ref(host, path): def ghcr_token(repo): url = "https://%s/token?scope=repository:%s:pull" % ("ghcr.io", repo) - try: - with urllib.request.urlopen(url, timeout=TIMEOUT) as r: - return json.load(r).get("token", "") - except Exception: - return "" + for delay in (0, 3, 8): # a token endpoint that errors once is not a missing package + time.sleep(delay) + try: + with urllib.request.urlopen(url, timeout=TIMEOUT) as r: + return json.load(r).get("token", "") + except Exception: + pass + return "" def registry_get(host, repo, ref): + """registry_get_once, retried when the answer says the NETWORK failed, not the registry. + + Status 0 (no HTTP response at all: reset, timeout, DNS) and 429/5xx are the registry or the + runner's path to it having a bad moment; 401 and 404 are answers about the reference and are + never retried, so a missing or private package still fails on the first try. + """ + st = 0 + for delay in (0, 3, 8): + time.sleep(delay) + st = registry_get_once(host, repo, ref) + if not (st == 0 or st == 429 or st >= 500): + return st + return st + + +def registry_get_once(host, repo, ref): """HEAD-ish GET of a manifest, ANONYMOUSLY. Returns HTTP status. 401 counts as a failure and that is deliberate: the child's kubelet and core-provider