From 800b6652d7936ff1e7fa1a914b8980fbe21844e7 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Thu, 21 Nov 2024 13:37:05 +0100 Subject: [PATCH] wip --- bazel/upload_systest_deps.sh | 36 +++++++++++++++++++------------- rs/ic_os/metrics_tool/src/lib.rs | 2 +- rs/tests/system_tests.bzl | 1 + 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/bazel/upload_systest_deps.sh b/bazel/upload_systest_deps.sh index df72053ad3bd..5fb97da04ddb 100755 --- a/bazel/upload_systest_deps.sh +++ b/bazel/upload_systest_deps.sh @@ -2,7 +2,7 @@ # TODO: extract artifacts.idx etc -foo() { +lookup_dep_url() { local redirect_url="https://artifacts.idx.dfinity.network/cas/$1" local result result=$(curl --silent --head \ @@ -31,7 +31,7 @@ foo() { # TODO: explain EMPTY_SHA=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -result_url=$(foo "$EMPTY_SHA") +result_url=$(lookup_dep_url "$EMPTY_SHA") echo "result url '$result_url' / '$EMPTY_SHA'" >&2 UPLOAD_URL="${result_url%"/$EMPTY_SHA"}" @@ -58,27 +58,35 @@ image_sha256=$(sha256sum "$image_filename" | cut -d' ' -f1) image_upload_url="$UPLOAD_URL/$image_sha256" echo found ic-os image "$image_varname -> $image_filename ($image_sha256)" >&2 -result_url=$(foo "$image_sha256") +result_url=$(lookup_dep_url "$image_sha256") if [ -n "$result_url" ]; then echo " image '$image_filename': already uploaded" >&2 else echo " image $image_filename not uploaded yet, uploading to $image_upload_url" >&2 curl --silent --fail "$image_upload_url" --upload-file "$image_filename" -fi -attempt=1 -result_url= -while [ "$attempt" -lt 10 ]; do - result_url=$(foo "$image_sha256") + attempt=1 + result_url= + while true; do + result_url=$(lookup_dep_url "$image_sha256") - if [ -n "$result_url" ]; then - break - fi + if [ -n "$result_url" ]; then + break + fi + + echo "attempt $attempt failed" + if [ "$attempt" -ge 10 ]; then + echo " giving up" >&2 + exit 1 + fi - echo "attempt $attempt failed, will retry in 1 s" >&2 - sleep 1 -done + echo " will retry in 1s" >&2 + sleep 1 + + attempt=$((attempt + 1)) + done +fi # extract "" from "https://artifacts..dfinity.network/..." cluster=$(sed <<<"$result_url" -n -E 's$^https://artifacts.([^.]+).*$\1$p') diff --git a/rs/ic_os/metrics_tool/src/lib.rs b/rs/ic_os/metrics_tool/src/lib.rs index 02bb129c55dd..4b33dba9a088 100644 --- a/rs/ic_os/metrics_tool/src/lib.rs +++ b/rs/ic_os/metrics_tool/src/lib.rs @@ -16,7 +16,7 @@ impl Metric { Self { name: name.to_string(), value, - annotation: "Custom metric".to_string(), + annotation: "Custom metric plop".to_string(), labels: Vec::new(), } } diff --git a/rs/tests/system_tests.bzl b/rs/tests/system_tests.bzl index 2fd37af4ff6f..99c56b995f73 100644 --- a/rs/tests/system_tests.bzl +++ b/rs/tests/system_tests.bzl @@ -32,6 +32,7 @@ def _run_system_test(ctx): done fi + unset ICOS_IMAGES # We export RUNFILES such that the from_location_specified_by_env_var() function in