Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nmattia committed Nov 21, 2024
1 parent 8c1e9b6 commit 800b665
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
36 changes: 22 additions & 14 deletions bazel/upload_systest_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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"}"
Expand All @@ -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 "<FOO>" from "https://artifacts.<FOO>.dfinity.network/..."
cluster=$(sed <<<"$result_url" -n -E 's$^https://artifacts.([^.]+).*$\1$p')
Expand Down
2 changes: 1 addition & 1 deletion rs/ic_os/metrics_tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
Expand Down
1 change: 1 addition & 0 deletions rs/tests/system_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 800b665

Please sign in to comment.