Skip to content

Commit 649fd86

Browse files
missing on step
1 parent 13a6747 commit 649fd86

4 files changed

Lines changed: 22 additions & 29 deletions

File tree

scripts/ops/dev-cluster/dev-common.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ verify_nodes() {
4545
if [[ "$info" == *"release=\"${version}\""* ]]; then ok=1; else fail=1; fi
4646
done
4747
[[ "$fail" -eq 0 && "$ok" -eq 1 ]] \
48-
&& echo "All nodes report release=\"${version}\"." \
49-
|| echo "Not all nodes are on ${version} yet."
48+
&& ok "All nodes report release=\"${version}\"." \
49+
|| warn "Not all nodes are on ${version} yet."
5050
}
5151

5252
# Submit a test signature request to the dev cluster contract (on-chain txn).
@@ -64,6 +64,6 @@ test_sign() {
6464
show_cmd "${cmd[@]}"
6565
confirm "Send it?" || return 0
6666
"${cmd[@]}" \
67-
&& echo "Signature returned — the cluster is signing." \
68-
|| echo "Test sign failed — investigate before proceeding."
67+
&& ok "Signature returned — the cluster is signing." \
68+
|| warn "Test sign failed — investigate before proceeding."
6969
}

scripts/ops/dev-cluster/dev-menu.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,16 @@ Upgrading the ${NETWORK} dev cluster to ${VERSION}
5252
EOF
5353
confirm "Proceed?" || { echo "Aborted."; exit 0; }
5454

55-
echo
56-
echo "### Step 1 — nodes"
55+
step "### Step 1 — nodes"
5756
run_cmd "${SCRIPT_DIR}/migrate-dev-cluster.sh" "$VERSION" \
5857
|| die "Node upgrade did not complete — stopping before the contract step."
5958

60-
echo
61-
echo "### Verify"
59+
step "### Verify"
6260
# Subshells: a die() here must not skip the contract step below.
6361
( verify_nodes "$VERSION" ) || true
6462
( test_sign "$NETWORK" ) || true
6563

66-
echo
67-
echo "### Step 2 — contract"
64+
step "### Step 2 — contract"
6865
echo "Only for releases that change crates/contract (diff it between the two tags)."
6966
if confirm "Upgrade the contract too?"; then
7067
run_cmd "${SCRIPT_DIR}/upgrade-dev-contract.sh" "$VERSION" "$NETWORK" || true
@@ -73,4 +70,4 @@ else
7370
fi
7471

7572
echo
76-
echo "Done. Testnet first — upgrade the mainnet dev cluster only once this one is healthy."
73+
ok "Done. Testnet first — upgrade the mainnet dev cluster only once this one is healthy."

scripts/ops/dev-cluster/migrate-dev-cluster.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ wait_for_alloc() {
6363
| jq -r --argjson v "$job_version" \
6464
'[.[] | select(.JobVersion == $v)] | sort_by(.CreateIndex) | last | .ClientStatus // "pending"')
6565
if [[ "$status" == "running" ]]; then
66-
echo "running."
66+
ok "running."
6767
return
6868
fi
6969
printf '.'
7070
sleep 5
7171
done
7272
echo
73-
echo " WARNING: allocation not running after 3m (last status: ${status}) — check the Nomad UI."
73+
warn " WARNING: allocation not running after 3m (last status: ${status}) — check the Nomad UI."
7474
}
7575

7676
upgrade_nomad_job() {
@@ -81,14 +81,14 @@ upgrade_nomad_job() {
8181
| select(startswith("nearone/mpc-node-gcp:"))] | unique | join(", ")' <<<"$job")
8282

8383
if [[ -z "$current" ]]; then
84-
echo "==> ${job_id}: no nearone/mpc-node-gcp task found, skipping."
84+
step "==> ${job_id}: no nearone/mpc-node-gcp task found, skipping."
8585
return
8686
fi
8787
if [[ "$current" == "$image" ]]; then
88-
echo "==> ${job_id}: already on ${image}, skipping."
88+
step "==> ${job_id}: already on ${image}, skipping."
8989
return
9090
fi
91-
echo "==> ${job_id}: ${current} -> ${image}"
91+
step "==> ${job_id}: ${current} -> ${image}"
9292

9393
updated=$(jq --arg img "$image" '(.TaskGroups[].Tasks[].Config
9494
| select(.image != null and (.image | startswith("nearone/mpc-node-gcp:")))).image = $img' <<<"$job")
@@ -100,7 +100,7 @@ upgrade_nomad_job() {
100100
failed=$(jq -r '.FailedTGAllocs // {} | keys | join(", ")' <<<"$plan")
101101
warnings=$(jq -r '.Warnings // empty' <<<"$plan")
102102
[[ -z "$failed" ]] || die "Plan reports failed allocations for: ${failed}"
103-
[[ -z "$warnings" ]] || echo " plan warnings: ${warnings}"
103+
[[ -z "$warnings" ]] || warn " plan warnings: ${warnings}"
104104

105105
confirm " Apply to ${job_id} on ${NOMAD_ADDR}?" || { echo " skipped."; return; }
106106
nomad_curl POST "/job/${job_id}" "$(jq -n --argjson job "$updated" '{Job: $job}')" >/dev/null \
@@ -123,7 +123,7 @@ if command -v skopeo >/dev/null 2>&1; then
123123
skopeo inspect --no-creds --format '{{.Digest}}' "docker://${IMAGE}" >/dev/null \
124124
|| die "${IMAGE} not found on Docker Hub — is the release published?"
125125
else
126-
echo "WARNING: skopeo not found, skipping existence check for ${IMAGE}."
126+
warn "WARNING: skopeo not found, skipping existence check for ${IMAGE}."
127127
fi
128128

129129
JOB_IDS=$(nomad_curl GET "/jobs?prefix=mpc-node" | jq -r '.[].ID') \

scripts/ops/dev-cluster/upgrade-dev-contract.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ fetch_wasm() {
4747

4848
if [[ "$source" == release ]]; then
4949
if [[ -f "$wasm" ]]; then
50-
echo "==> Reusing ${wasm}" >&2
50+
step "==> Reusing ${wasm}" >&2
5151
else
52-
echo "==> Downloading contract WASM from release ${version}..." >&2
52+
step "==> Downloading contract WASM from release ${version}..." >&2
5353
require_cmds gh tar
5454
run_cmd gh release download "$version" --repo near/mpc \
5555
--pattern "mpc-contract-v${version}.tar.gz" --dir "$dir" --clobber >&2
@@ -60,7 +60,7 @@ fetch_wasm() {
6060
require_cmds cargo git
6161
local root built
6262
root=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)
63-
echo "==> Building the contract from ${root} (local build — not a released artifact)..." >&2
63+
step "==> Building the contract from ${root} (local build — not a released artifact)..." >&2
6464
( cd "$root" && run_cmd cargo near build non-reproducible-wasm --features abi \
6565
--profile=release-contract --manifest-path crates/contract/Cargo.toml --locked >&2 )
6666
built=$(find "${root}/target/near" -maxdepth 1 -name '*.wasm' -newermt '-10 minutes' \
@@ -94,24 +94,22 @@ WASM_SIZE=$(wc -c < "$WASM")
9494
} > "$SERIALIZED"
9595
[[ "$(wc -c < "$SERIALIZED")" -eq $((WASM_SIZE + 6)) ]] \
9696
|| die "serialized.bin has an unexpected length."
97-
echo "==> ${SERIALIZED} ready ($(wc -c < "$SERIALIZED") bytes)"
97+
step "==> ${SERIALIZED} ready ($(wc -c < "$SERIALIZED") bytes)"
9898

9999
PROPOSER=${MEMBER_ACCOUNTS%% *}
100100
PROPOSE_CMD=(near contract call-function as-transaction "$CONTRACT" propose_update
101101
file-args "$SERIALIZED" prepaid-gas '100.0 Tgas' attached-deposit "$PROPOSE_DEPOSIT"
102102
sign-as "$PROPOSER" network-config "$NEAR_NET" "$SIGN_WITH" send)
103103

104-
echo
105-
echo "About to propose the ${VERSION} contract on ${CONTRACT} (${NEAR_NET})"
104+
step "About to propose the ${VERSION} contract on ${CONTRACT} (${NEAR_NET})"
106105
echo " proposer: ${PROPOSER}, deposit ${PROPOSE_DEPOSIT}"
107106
show_cmd "${PROPOSE_CMD[@]}"
108107
confirm "Send propose_update?" || { echo "Aborted before proposing."; exit 0; }
109108

110109
"${PROPOSE_CMD[@]}" \
111110
|| die "propose_update failed (an account low on NEAR is the usual cause — top it up)."
112111

113-
echo
114-
echo "==> Pending proposals:"
112+
step "==> Pending proposals:"
115113
run_cmd near contract call-function as-read-only "$CONTRACT" proposed_updates \
116114
json-args '{}' network-config "$NEAR_NET" now || true
117115

@@ -122,7 +120,6 @@ read -rp "UpdateId to vote on: " UPDATE_ID
122120

123121
# The vote that reaches threshold deploys + migrates inline, hence 300 Tgas.
124122
for account in $MEMBER_ACCOUNTS; do
125-
echo
126123
vote_cmd=(near contract call-function as-transaction "$CONTRACT" vote_update
127124
json-args "{\"id\": ${UPDATE_ID}}" prepaid-gas '300.0 Tgas' attached-deposit '0 NEAR'
128125
sign-as "$account" network-config "$NEAR_NET" "$SIGN_WITH" send)
@@ -131,7 +128,6 @@ for account in $MEMBER_ACCOUNTS; do
131128
"${vote_cmd[@]}" || echo " vote failed for ${account}."
132129
done
133130

134-
echo
135-
echo "==> Contract version (expect ${VERSION} once threshold was reached):"
131+
step "==> Contract version (expect ${VERSION} once threshold was reached):"
136132
run_cmd near contract call-function as-read-only "$CONTRACT" version \
137133
json-args '{}' network-config "$NEAR_NET" now || true

0 commit comments

Comments
 (0)