mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
[CI] Fix check-tx-version Gitlab job (#2449)
* set -e for tx job * dont set -e while we investigate * fetch latest release polkadot * add jq to node:15 image * Add logic for timing out if nodes never start listening * remove trap
This commit is contained in:
@@ -157,8 +157,9 @@ check-transaction-versions:
|
|||||||
<<: *docker-env
|
<<: *docker-env
|
||||||
needs:
|
needs:
|
||||||
- job: test-linux-stable
|
- job: test-linux-stable
|
||||||
artifacts: false
|
artifacts: true
|
||||||
before_script:
|
before_script:
|
||||||
|
- apt-get -y update; apt-get -y install jq lsof
|
||||||
- npm install --ignore-scripts -g @polkadot/metadata-cmp
|
- npm install --ignore-scripts -g @polkadot/metadata-cmp
|
||||||
- git fetch origin release
|
- git fetch origin release
|
||||||
script:
|
script:
|
||||||
|
|||||||
@@ -117,3 +117,10 @@ skip_if_companion_pr() {
|
|||||||
echo "[+] PR is not a companion PR. Proceeding test"
|
echo "[+] PR is not a companion PR. Proceeding test"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Fetches the tag name of the latest release from a repository
|
||||||
|
# repo: 'organisation/repo'
|
||||||
|
# Usage: latest_release 'paritytech/polkadot'
|
||||||
|
latest_release() {
|
||||||
|
curl -s "$api_base/$1/releases/latest" | jq -r '.tag_name'
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
BIN=./target/release/polkadot
|
set -e
|
||||||
LIVE_WS=wss://rpc.polkadot.io
|
|
||||||
LOCAL_WS=ws://localhost:9944
|
|
||||||
|
|
||||||
# Kill the polkadot client before exiting
|
# Include the common functions library
|
||||||
trap 'kill "$(jobs -p)"' EXIT
|
#shellcheck source=../common/lib.sh
|
||||||
|
. "$(dirname "${0}")/../common/lib.sh"
|
||||||
|
|
||||||
|
HEAD_BIN=./target/release/polkadot
|
||||||
|
HEAD_WS=ws://localhost:9944
|
||||||
|
RELEASE_WS=ws://localhost:9945
|
||||||
|
|
||||||
runtimes=(
|
runtimes=(
|
||||||
"westend"
|
"westend"
|
||||||
@@ -12,6 +15,14 @@ runtimes=(
|
|||||||
"polkadot"
|
"polkadot"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# First we fetch the latest released binary
|
||||||
|
latest_release=$(latest_release 'paritytech/polkadot')
|
||||||
|
RELEASE_BIN="./polkadot-$latest_release"
|
||||||
|
echo "[+] Fetching binary for Polkadot version $latest_release"
|
||||||
|
curl -L "https://github.com/paritytech/polkadot/releases/download/$latest_release/polkadot" > "$RELEASE_BIN" || exit 1
|
||||||
|
chmod +x "$RELEASE_BIN"
|
||||||
|
|
||||||
|
|
||||||
for RUNTIME in "${runtimes[@]}"; do
|
for RUNTIME in "${runtimes[@]}"; do
|
||||||
echo "[+] Checking runtime: ${RUNTIME}"
|
echo "[+] Checking runtime: ${RUNTIME}"
|
||||||
|
|
||||||
@@ -32,19 +43,29 @@ for RUNTIME in "${runtimes[@]}"; do
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$RUNTIME" = 'polkadot' ]; then
|
# Start running the nodes in the background
|
||||||
LIVE_WS="wss://rpc.polkadot.io"
|
$HEAD_BIN --chain="$RUNTIME-local" --tmp &
|
||||||
else
|
$RELEASE_BIN --chain="$RUNTIME-local" --ws-port 9945 --tmp &
|
||||||
LIVE_WS="wss://${RUNTIME}-rpc.polkadot.io"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start running the local polkadot node in the background
|
|
||||||
$BIN --chain="$RUNTIME-local" &
|
|
||||||
jobs
|
jobs
|
||||||
|
|
||||||
|
# Sleep a little to allow the nodes to spin up and start listening
|
||||||
|
TIMEOUT=5
|
||||||
|
for i in $(seq $TIMEOUT); do
|
||||||
|
sleep 1
|
||||||
|
if [ "$(lsof -nP -iTCP -sTCP:LISTEN | grep -c '994[45]')" == 2 ]; then
|
||||||
|
echo "[+] Both nodes listening"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ "$i" == $TIMEOUT ]; then
|
||||||
|
echo "[!] Both nodes not listening after $i seconds. Exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
sleep 5
|
||||||
|
|
||||||
changed_extrinsics=$(
|
changed_extrinsics=$(
|
||||||
polkadot-js-metadata-cmp "$LIVE_WS" "$LOCAL_WS" \
|
polkadot-js-metadata-cmp "$RELEASE_WS" "$HEAD_WS" \
|
||||||
| sed 's/^ \+//g' | grep -e 'idx: [0-9]\+ -> [0-9]\+'
|
| sed 's/^ \+//g' | grep -e 'idx: [0-9]\+ -> [0-9]\+' || true
|
||||||
)
|
)
|
||||||
|
|
||||||
if [ -n "$changed_extrinsics" ]; then
|
if [ -n "$changed_extrinsics" ]; then
|
||||||
@@ -54,6 +75,8 @@ for RUNTIME in "${runtimes[@]}"; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[+] No change in extrinsics ordering for the ${RUNTIME} runtime"
|
echo "[+] No change in extrinsics ordering for the ${RUNTIME} runtime"
|
||||||
kill "$(jobs -p)"; sleep 5
|
jobs -p | xargs kill; sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Sleep a little to let the jobs die properly
|
||||||
|
sleep 5
|
||||||
|
|||||||
Reference in New Issue
Block a user