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 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: