-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deployments): native network test (#9138)
This runs a version of the tmux-outputting test that is normally runnable with: ``` ./bootstrap.sh fast yarn-project/end-to-end/scripts/native_network_test.sh \ ./test-transfer.sh \ ./deploy-l1-contracts.sh \ ./deploy-l2-contracts.sh \ ./boot-node.sh \ ./ethereum.sh \ "./prover-node.sh false" \ ./pxe.sh \ ./transaction-bot.sh \ "./validator.sh 8081" ``` it uses the RUN_INTERLEAVED=1 env var to make it suitable output for CI. This catches application issues, isolating them from k8s-specific issues. It is meant to continue to be maintained alongside the k8s deploy as this is by far the most productive dev workflow, being able to simply restart network components after tweaks (especially with yarn build:dev)
- Loading branch information
Showing
12 changed files
with
97 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
VERSION 0.8 | ||
|
||
scripts: | ||
FROM scratch | ||
COPY *.sh . | ||
SAVE ARTIFACT *.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,58 @@ | ||
#!/bin/bash | ||
set -eu | ||
# propagate errors inside while loop pipe | ||
set -o pipefail | ||
|
||
# Usage: run_bg_args.sh <main command> <background commands>... | ||
# Usage: run_interleaved.sh <main command> <background commands>... | ||
# Runs the main command with output logging and background commands without logging. | ||
# Finishes when the main command exits. | ||
|
||
# Check if at least two commands are provided (otherwise what is the point) | ||
if [ "$#" -lt 2 ]; then | ||
echo "Usage: $0 <main-command> <background commands>..." | ||
exit 1 | ||
echo "Usage: $0 <main-command> <background commands>..." | ||
exit 1 | ||
fi | ||
|
||
# Define colors | ||
colors=( | ||
"\e[33m" # Yellow | ||
"\e[34m" # Blue | ||
"\e[35m" # Magenta | ||
"\e[36m" # Cyan | ||
"\e[92m" # Bright Green | ||
"\e[93m" # Bright Yellow | ||
"\e[94m" # Bright Blue | ||
"\e[95m" # Bright Magenta | ||
"\e[96m" # Bright Cyan | ||
"\e[91m" # Bright Red | ||
) | ||
|
||
main_cmd="$1" | ||
shift | ||
|
||
# Function to run a command and prefix the output | ||
function run_command() { | ||
local cmd="$1" | ||
while IFS= read -r line; do | ||
echo "[$cmd] $line" | ||
done < <($cmd 2>&1) | ||
# pattern from https://stackoverflow.com/questions/28238952/how-to-kill-a-running-bash-function-from-terminal | ||
function cleanup_function() { | ||
kill $(jobs -p) 2>/dev/null || true | ||
return | ||
} | ||
|
||
# Run the main command, piping output through the run_command function | ||
run_command "$main_cmd" & | ||
main_pid=$! | ||
# Function to run a command and prefix the output with color | ||
function run_command() { | ||
# pattern from https://stackoverflow.com/questions/28238952/how-to-kill-a-running-bash-function-from-terminal | ||
trap cleanup_function INT EXIT | ||
local cmd="$1" | ||
local color="$2" | ||
$cmd 2>&1 | while IFS= read -r line; do | ||
echo -e "${color}[$cmd]\e[0m $line" | ||
done | ||
} | ||
|
||
# Run background commands without logging output | ||
declare -a bg_pids | ||
i=0 | ||
for cmd in "$@"; do | ||
run_command "$cmd" & | ||
bg_pids+=($!) | ||
done | ||
|
||
# Wait for the main command to finish and capture its exit code | ||
wait $main_pid | ||
main_exit_code=$? | ||
|
||
# Kill any remaining background jobs | ||
for pid in "${bg_pids[@]}"; do | ||
kill "$pid" 2>/dev/null || true | ||
run_command "$cmd" "${colors[$((i % ${#colors[@]}))]}" & | ||
((i++)) || true # annoyingly considered a failure based on result | ||
done | ||
|
||
# Exit with the same code as the main command | ||
exit $main_exit_code | ||
# Run the main command synchronously, piping output through the run_command function with green color | ||
run_command "$main_cmd" "\e[32m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters