From 0a417ab1fc5b86e273fc8cefc6a00e2cc40bc3bb Mon Sep 17 00:00:00 2001 From: Nicolas Ochem Date: Mon, 11 Sep 2023 12:36:56 -0700 Subject: [PATCH 1/2] chain activation: avoid misfiring when activate job gets a successful RPC response for the first time, it should not repeat the query; instead, just parse the output again and check whether the level is zero. This way, if the second rpc query fails, it will just restart the job instead of passing silently, resulting in a non-activated chain stuck at level 0, as happened on Mondaynet today. --- charts/tezos/scripts/chain-initiator.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/charts/tezos/scripts/chain-initiator.sh b/charts/tezos/scripts/chain-initiator.sh index d26fbbaf8..bb246c04b 100644 --- a/charts/tezos/scripts/chain-initiator.sh +++ b/charts/tezos/scripts/chain-initiator.sh @@ -1,20 +1,21 @@ CLIENT="/usr/local/bin/octez-client --endpoint http://tezos-node-rpc:8732" -until $CLIENT rpc get /chains/main/blocks/head/header | grep '"level":'; do +OUTPUT="" +until OUTPUT=$($CLIENT rpc get /chains/main/blocks/head/header) && echo "$OUTPUT" | grep '"level":'; do sleep 2 done set -x set -o pipefail -if ! $CLIENT rpc get /chains/main/blocks/head/header | grep '"level": 0,'; then +if ! echo "$OUTPUT" | grep '"level": 0,'; then echo "Chain already activated, considering activation successful and exiting" exit 0 fi echo Activating chain: -$CLIENT -d /var/tezos/client --block \ - genesis activate protocol \ - {{ .Values.activation.protocol_hash }} \ - with fitness 1 and key \ - $( cat /etc/tezos/activation_account_name ) \ - and parameters /etc/tezos/parameters.json 2>&1 | head -200 +$CLIENT -d /var/tezos/client --block \ + genesis activate protocol \ + {{ .Values.activation.protocol_hash }} \ + with fitness 1 and key \ + $( cat /etc/tezos/activation_account_name ) \ + and parameters /etc/tezos/parameters.json 2>&1 | head -200 From 9bc910b985084677028c666e1b077ed7c2284bb8 Mon Sep 17 00:00:00 2001 From: Nicolas Ochem Date: Mon, 11 Sep 2023 12:48:59 -0700 Subject: [PATCH 2/2] fix helm tests --- test/charts/private-chain.expect.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/charts/private-chain.expect.yaml b/test/charts/private-chain.expect.yaml index c7b1c84fe..fd60278d9 100644 --- a/test/charts/private-chain.expect.yaml +++ b/test/charts/private-chain.expect.yaml @@ -1620,24 +1620,25 @@ spec: - | CLIENT="/usr/local/bin/octez-client --endpoint http://tezos-node-rpc:8732" - until $CLIENT rpc get /chains/main/blocks/head/header | grep '"level":'; do + OUTPUT="" + until OUTPUT=$($CLIENT rpc get /chains/main/blocks/head/header) && echo "$OUTPUT" | grep '"level":'; do sleep 2 done set -x set -o pipefail - if ! $CLIENT rpc get /chains/main/blocks/head/header | grep '"level": 0,'; then + if ! echo "$OUTPUT" | grep '"level": 0,'; then echo "Chain already activated, considering activation successful and exiting" exit 0 fi echo Activating chain: - $CLIENT -d /var/tezos/client --block \ - genesis activate protocol \ - PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY \ - with fitness 1 and key \ - $( cat /etc/tezos/activation_account_name ) \ - and parameters /etc/tezos/parameters.json 2>&1 | head -200 + $CLIENT -d /var/tezos/client --block \ + genesis activate protocol \ + PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY \ + with fitness 1 and key \ + $( cat /etc/tezos/activation_account_name ) \ + and parameters /etc/tezos/parameters.json 2>&1 | head -200 envFrom: env: