diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d5bba990..4d54c1d14 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -602,6 +602,14 @@ jobs: - name: 🛡️ Backwards compatibility test run: make backwards-compat-test + - name: 📋 Upload node logs on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: bw-compat-logs + path: scripts/bw-compatibility-test/logs/ + retention-days: 7 + ######################################### # Auto Cache Cleanup on Pull Requests ######################################### diff --git a/scripts/bw-compatibility-test/docker-compose.override.yaml b/scripts/bw-compatibility-test/docker-compose.override.yaml index 51ca758b9..59dc9830f 100644 --- a/scripts/bw-compatibility-test/docker-compose.override.yaml +++ b/scripts/bw-compatibility-test/docker-compose.override.yaml @@ -42,6 +42,7 @@ services: --protocol.zero-conf --protocol.simple-taproot-chans --trickledelay=50 + --historicalsyncinterval=10s dave-pr: image: lnd-dev:backward-compat-test-build @@ -83,5 +84,6 @@ services: --protocol.zero-conf --protocol.simple-taproot-chans --trickledelay=50 + --historicalsyncinterval=10s --db.backend=sqlite --db.use-native-sql diff --git a/scripts/bw-compatibility-test/docker-compose.yaml b/scripts/bw-compatibility-test/docker-compose.yaml index 7860b4415..ea901e699 100644 --- a/scripts/bw-compatibility-test/docker-compose.yaml +++ b/scripts/bw-compatibility-test/docker-compose.yaml @@ -71,6 +71,7 @@ services: - "--protocol.zero-conf" - "--protocol.simple-taproot-chans" - "--trickledelay=50" + - "--historicalsyncinterval=10s" bob: image: lightninglabs/lnd:${LND_LATEST_VERSION} @@ -111,6 +112,7 @@ services: - "--protocol.zero-conf" - "--protocol.simple-taproot-chans" - "--trickledelay=50" + - "--historicalsyncinterval=10s" charlie: image: lightninglabs/lnd:${LND_LATEST_VERSION} @@ -148,6 +150,7 @@ services: - "--tlsextradomain=charlie" - "--accept-keysend" - "--trickledelay=50" + - "--historicalsyncinterval=10s" dave: image: lightninglabs/lnd:${LND_LATEST_VERSION} @@ -185,6 +188,7 @@ services: - "--tlsextradomain=dave" - "--accept-keysend" - "--trickledelay=50" + - "--historicalsyncinterval=10s" - "--db.backend=sqlite" - "--db.use-native-sql" diff --git a/scripts/bw-compatibility-test/network.sh b/scripts/bw-compatibility-test/network.sh index 98eca675b..c712381f8 100644 --- a/scripts/bw-compatibility-test/network.sh +++ b/scripts/bw-compatibility-test/network.sh @@ -298,6 +298,24 @@ wait_for_active_chans() { echo "🟢 $node now has exactly $expected_channels active channels!" } +# collect_logs copies the lnd log file from each running container into a +# local ./logs directory. Call this before compose_down so logs are available +# for CI artifact upload even after the cluster is torn down. +function collect_logs() { + local log_dir="$DIR/logs" + mkdir -p "$log_dir" + + for node in alice bob charlie dave bob-pr dave-pr; do + if docker ps -a --format '{{.Names}}' | grep -q "^${node}$"; then + mkdir -p "$log_dir/$node" + docker cp "$node:/root/.lnd/logs/bitcoin/regtest/lnd.log" \ + "$log_dir/$node/lnd.log" 2>/dev/null || true + fi + done + + echo "📋 Logs collected in $log_dir" +} + # mine mines a number of blocks on the regtest network. If no # argument is provided, it defaults to 6 blocks. function mine() { diff --git a/scripts/bw-compatibility-test/test.sh b/scripts/bw-compatibility-test/test.sh index d8bb6660e..7b9f2f7bf 100755 --- a/scripts/bw-compatibility-test/test.sh +++ b/scripts/bw-compatibility-test/test.sh @@ -16,8 +16,9 @@ cd $DIR compose_up # Ensure that the cluster is shut down when the script exits -# regardless of success -trap compose_down EXIT +# regardless of success. Logs are collected first so they are +# available for CI artifact upload after the cluster is torn down. +trap 'collect_logs; compose_down' EXIT # Set up the network. setup_network