From 3e585b8d53aaa08131e987510029fdfe0bd76dff Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 8 Jul 2025 04:33:02 +0000 Subject: [PATCH 1/3] ci: OPTE rev check could be better with GitHub errors --- tools/ci_check_opte_ver.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/ci_check_opte_ver.sh b/tools/ci_check_opte_ver.sh index 5d345134b59..4f1e099d9ea 100755 --- a/tools/ci_check_opte_ver.sh +++ b/tools/ci_check_opte_ver.sh @@ -33,7 +33,26 @@ API_VER=$(curl -s https://raw.githubusercontent.com/oxidecomputer/opte/"$OPTE_RE # use the total number of pages to get the total number of commits. # Thus the query parameter `page` in the "last" link (e.g. `&page=162`) # gives us the rev count we want. -REV_COUNT=$(curl -I -s "https://api.github.com/repos/oxidecomputer/opte/commits?per_page=1&sha=$OPTE_REV" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p') +# +# We should be resilient against a transient GitHub issue here. If GitHub gives +# any answer, we'll carry on trying to get a page number out, but we really +# shouldn't if we get a non-200 error. We could `curl -f` to fail for a 4xx or +# above status, but then the observed output when this fails would be an opaque +# "exited with status 22" or something. Help ourselves out and keep the response +# head, printing that if something goes sideways instead. +COMMIT_INFO_HEAD="$(curl -I -s "https://api.github.com/repos/oxidecomputer/opte/commits?per_page=1&sha=$OPTE_REV")" +REV_COUNT=$(echo "$COMMIT_INFO_HEAD" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p') + +if [ -z "$REV_COUNT" ]; then + # We didn't get a OPTE rev out. The rev *should* exist, so it should not be + # a 404. If this is a 5xx, it might be a transient error from GitHub. In + # either case, errors are infrequent enough lets just dump the response head + # and hope someone can do something contextually appropriate. And hope this + # doesn't become regular enough anyone wants to be smarter. + echo "Could not get rev count from GitHub response. Response headers:" + echo "$COMMIT_INFO_HEAD" + exit 1 +fi # Combine the API version and the revision count to get the full version OPTE_VER="0.$API_VER.$REV_COUNT" From 96e620a50dadee99b62cb525b9e3ac02d0145b79 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 8 Jul 2025 07:39:18 +0000 Subject: [PATCH 2/3] dummy Cargo.toml change to make the opte check run --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 65a01815eb0..38017c35bea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -990,3 +990,4 @@ path = "workspace-hack" [patch."https://github.com/oxidecomputer/omicron"] omicron-uuid-kinds = { path = "uuid-kinds" } omicron-common = { path = "common" } + From 48c75752c1e4f9857a356444ea6144fed6feea7e Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 8 Jul 2025 18:04:53 +0000 Subject: [PATCH 3/3] Revert "dummy Cargo.toml change to make the opte check run" This reverts commit 96e620a50dadee99b62cb525b9e3ac02d0145b79. --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 38017c35bea..65a01815eb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -990,4 +990,3 @@ path = "workspace-hack" [patch."https://github.com/oxidecomputer/omicron"] omicron-uuid-kinds = { path = "uuid-kinds" } omicron-common = { path = "common" } -