Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
5832478
rename and change logic to add fallaback
pepoviola Oct 2, 2025
9d376ef
make test fails to check the send logs logic
pepoviola Oct 2, 2025
c5a53b5
fmt
pepoviola Oct 2, 2025
193e415
fix: improve log processing script with error handling and multiple t…
DenzelPenzel Oct 3, 2025
eb0a466
feat: improve workflow status checks with retries, timeouts and error…
DenzelPenzel Oct 3, 2025
44f0ee4
fix: use correct script name for processing zombienet logs
DenzelPenzel Oct 3, 2025
2eb7161
refactor: reorganize log processing script and fix zombienet SDK scri…
DenzelPenzel Oct 4, 2025
63814d9
Merge branch 'master' into zombienet-fix-process-logs
pepoviola Oct 6, 2025
fabb18d
refactor: simplify GitHub workflow by removing cancelled state handli…
DenzelPenzel Oct 6, 2025
da2d634
Merge remote-tracking branch 'origin/zombienet-fix-process-logs' into…
DenzelPenzel Oct 6, 2025
180dd43
chore: add issue numbers to flaky zombienet tests
DenzelPenzel Oct 6, 2025
3e27d51
chore: add issue numbers to flaky zombienet tests
DenzelPenzel Oct 7, 2025
098fc00
feat: add logging groups and improved output formatting to artifact d…
DenzelPenzel Oct 7, 2025
be89f41
set timeout in test steps
pepoviola Oct 8, 2025
99c1855
Merge branch 'master' into zombienet-fix-process-logs
DenzelPenzel Oct 8, 2025
92bd1dd
move logs to workflows
pepoviola Oct 8, 2025
f861b11
remove invalid keys from actions
pepoviola Oct 8, 2025
7558992
Merge branch 'master' into zombienet-fix-process-logs
DenzelPenzel Oct 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 0 additions & 110 deletions .github/scripts/process-logs-zombienet-sdk.sh

This file was deleted.

166 changes: 166 additions & 0 deletions .github/scripts/process-logs-zombienet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
#!/bin/bash

# This script processes logs produced by nodes spawned using the zombienet-sdk framework.
# The logs are prepared for upload as GitHub artifacts.
# If Loki logging is available, the corresponding log URLs are also printed.
# NOTE: P2838773B5F7DE937 is the loki.cicd until we switch to loki.zombienet
LOKI_URL_FOR_NODE='https://grafana.teleport.parity.io/explore?orgId=1&left=%7B%22datasource%22:%22P2838773B5F7DE937%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22P2838773B5F7DE937%22%7D,%22editorMode%22:%22code%22,%22expr%22:%22%7Bzombie_ns%3D%5C%22{{namespace}}%5C%22,zombie_node%3D%5C%22{{podName}}%5C%22%7D%22,%22queryType%22:%22range%22%7D%5D,%22range%22:%7B%22from%22:%22{{from}}%22,%22to%22:%22{{to}}%22%7D%7D'


LOKI_DIR_FOR_NATIVE_LOGS="/tmp/zombienet"

# JQ queries
JQ_QUERY_RELAY_V1='.relay[].name'
JQ_QUERY_RELAY_SDK='.relay.nodes[].name'

JQ_QUERY_PARA_NODES_V1='.paras[$pid].nodes[].name'
JQ_QUERY_PARA_NODES_SDK='.parachains[$pid][] .collators[].name'

# current time in milliseconds + 60 secs to allow loki to ingest logs
TO=$(($(date +%s%3N) + 60000))




BASE_DIRS=$(ls -dt /tmp/zombie-*)
for $BASE_DIR in $BASE_DIRS; do
# Make sure target directory exists
TARGET_DIR="$BASE_DIR/logs"
mkdir -p "$TARGET_DIR"
ZOMBIE_JSON="$BASE_DIR/zombie.json"

if [[ ! -f "$ZOMBIE_JSON" ]]; then
echo "Zombie file $ZOMBIE_JSON not present, calling fallback"
process_logs_from_fallbak $BASE_DIR $TARGET_DIR
else
# we have a zombie.json file, let process it
process_logs_from_zombie_file $BASE_DIR $TARGET_DIR $ZOMBIE_JSON
fi
done;




# Since we don't have the zombie.json file, we will make the best-effort to send the logs
process_logs_from_fallbak() {
local BASE_DIR="$1"
local TARGET_DIR="$2"

# extract ns name to use from BASE_DIR

# find all logs with the pattern <name>.log

# Iterate for each item
# extract name from name.log

# send the logs


# local_to=$TO
# if [[ "$ZOMBIE_PROVIDER" == "k8s" ]]; then
# # Fetching logs from k8s
# if ! kubectl logs "$name" -c "$name" -n "$NS" > "$TARGET_DIR/$name.log" ; then
# echo "::warning ::Failed to fetch logs for $name"
# fi
# else
# # zombienet v1 dump the logs to the `/logs` directory
# if [ ! -f "$TARGET_DIR/$name.log" ]; then
# # `sdk` use this pattern to store the logs in native provider
# cp "$BASE_DIR/$name/$name.log" "$TARGET_DIR/$name.log"
# fi

# # send logs to loki
# if [ -d "$LOKI_DIR_FOR_NATIVE_LOGS" ]; then
# awk -v NS="$NS" -v NAME="$name" '{print NS" "NAME" " $0}' $TARGET_DIR/$name.log >> $LOKI_DIR_FOR_NATIVE_LOGS/to-loki.log
# local_to=$(($(date +%s%3N) + 60000))
# fi
# fi
# echo -e "\t$name: $(make_url "$name" "$local_to")"

}

process_logs_from_zombie_file() {
local BASE_DIR="$1"
local TARGET_DIR="$2"
local ZOMBIE_JSON="$3"

# Extract namespace (ns in sdk / namespace in v1)
NS=$(jq -r '.ns // .namespace' "$ZOMBIE_JSON")
# test start time in milliseconds
FROM=$(jq -r '.start_time_ts' "$ZOMBIE_JSON")

echo "Relay nodes:"

JQ_QUERY_RELAY=$JQ_QUERY_RELAY_V1
JQ_QUERY_PARA_NODES=$JQ_QUERY_PARA_NODES_V1
if [[ $(echo "$NS" | grep -E "zombie-[A-Fa-f0-9]+-") ]]; then
JQ_QUERY_RELAY=$JQ_QUERY_RELAY_SDK
JQ_QUERY_PARA_NODES=$JQ_QUERY_PARA_NODES_SDK
fi;

jq -r $JQ_QUERY_RELAY "$ZOMBIE_JSON" | while read -r name; do
local_to=$TO
if [[ "$ZOMBIE_PROVIDER" == "k8s" ]]; then
# Fetching logs from k8s
if ! kubectl logs "$name" -c "$name" -n "$NS" > "$TARGET_DIR/$name.log" ; then
echo "::warning ::Failed to fetch logs for $name"
fi
else
# zombienet v1 dump the logs to the `/logs` directory
if [ ! -f "$TARGET_DIR/$name.log" ]; then
# `sdk` use this pattern to store the logs in native provider
cp "$BASE_DIR/$name/$name.log" "$TARGET_DIR/$name.log"
fi

# send logs to loki
if [ -d "$LOKI_DIR_FOR_NATIVE_LOGS" ]; then
awk -v NS="$NS" -v NAME="$name" '{print NS" "NAME" " $0}' $TARGET_DIR/$name.log >> $LOKI_DIR_FOR_NATIVE_LOGS/to-loki.log
local_to=$(($(date +%s%3N) + 60000))
fi
fi
echo -e "\t$name: $(make_url "$name" "$local_to")"
done
echo ""

# Handle parachains grouped by paraId
jq -r '.paras // .parachains | to_entries[] | "\(.key)"' "$ZOMBIE_JSON" | while read -r para_id; do
echo "ParaId: $para_id"
jq -r --arg pid "$para_id" "$JQ_QUERY_PARA_NODES" "$ZOMBIE_JSON" | while read -r name; do
local_to=$TO
if [[ "$ZOMBIE_PROVIDER" == "k8s" ]]; then
# Fetching logs from k8s
if ! kubectl logs "$name" -c "$name" -n "$NS" > "$TARGET_DIR/$name.log" ; then
echo "::warning ::Failed to fetch logs for $name"
fi
else
# zombienet v1 dump the logs to the `/logs` directory
if [ ! -f "$TARGET_DIR/$name.log" ]; then
# `sdk` use this pattern to store the logs in native provider
cp "$BASE_DIR/$name/$name.log" "$TARGET_DIR/$name.log"
fi

# send logs to loki
if [ -d "$LOKI_DIR_FOR_NATIVE_LOGS" ]; then
awk -v NS="$NS" -v NAME="$name" '{print NS" "NAME" " $0}' $TARGET_DIR/$name.log >> $LOKI_DIR_FOR_NATIVE_LOGS/to-loki.log
local_to=$(($(date +%s%3N) + 60000))
fi
fi
echo -e "\t$name: $(make_url "$name" "$local_to")"
done
echo ""
done
}

make_url() {
local name="$1"
local to="$2"
local url="${LOKI_URL_FOR_NODE//\{\{namespace\}\}/$NS}"
url="${url//\{\{podName\}\}/$name}"
url="${url//\{\{from\}\}/$FROM}"
url="${url//\{\{to\}\}/$to}"
echo "$url"
}


# sleep for a minute to give alloy time to forward logs
sleep 60
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ async fn sync_backing_test() -> Result<(), anyhow::Error> {
.with_default_command("test-parachain")
.with_default_image(images.cumulus.as_str())
.with_chain("sync-backing")
.with_default_args(vec![("-lparachain=debug,aura=debug").into()])
.with_default_args(vec![
("-lparachain=debug,aura=debug").into(),
("--make-it-fail").into()
])
.with_collator(|n| n.with_name("collator-2500"))
})
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ chain = "local"
[[relaychain.nodes]]
name = "bob"
validator = true
args = ["--make-it-fail"]
Loading