From 42ea85cfaf2c553f2b89ea8cc4f74c8a52579625 Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Fri, 31 May 2024 15:56:28 +0530 Subject: [PATCH 01/14] feat: kurtosis local testing script --- .dockerignore | 1 + Dockerfile | 46 +++++++++ assertoor.yaml | 32 ++++++ kurtosis-network-params.yml | 32 ++++++ run-kurtosis-check.sh | 191 ++++++++++++++++++++++++++++++++++++ 5 files changed, 302 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 assertoor.yaml create mode 100644 kurtosis-network-params.yml create mode 100755 run-kurtosis-check.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..208a59913 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +vendor/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..20550a89a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,46 @@ +# Nimbus +# Copyright (c) 2018-2024 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or +# http://www.apache.org/licenses/LICENSE-2.0) +# * MIT license ([LICENSE-MIT](LICENSE-MIT) or +# http://opensource.org/licenses/MIT) +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. + +FROM debian:testing-slim AS build + +SHELL ["/bin/bash", "-c"] + +RUN apt-get clean && apt update \ + && apt -y install build-essential git-lfs librocksdb-dev libpcre3-dev + +RUN ldd --version ldd + +ADD . /root/nimbus-eth1 + +RUN cd /root/nimbus-eth1 \ + && make -j$(nproc) update \ + && make -j$(nproc) V=1 LOG_LEVEL=TRACE nimbus + +# --------------------------------- # +# Starting new image to reduce size # +# --------------------------------- # +FROM debian:testing-slim as deploy + +SHELL ["/bin/bash", "-c"] +RUN apt-get clean && apt update \ + && apt -y install build-essential librocksdb-dev libpcre3-dev +RUN apt update && apt -y upgrade + +RUN ldd --version ldd + +RUN rm -rf /home/user/nimbus-eth1/build/nimbus + +COPY --from=build /root/nimbus-eth1/build/nimbus /home/user/nimbus-eth1/build/nimbus + +ENV PATH="/home/user/nimbus-eth1/build:${PATH}" +ENTRYPOINT ["nimbus"] +WORKDIR /home/user/nimbus-eth1/build + +STOPSIGNAL SIGINT \ No newline at end of file diff --git a/assertoor.yaml b/assertoor.yaml new file mode 100644 index 000000000..c81189831 --- /dev/null +++ b/assertoor.yaml @@ -0,0 +1,32 @@ +# Nimbus +# Copyright (c) 2018-2024 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or +# http://www.apache.org/licenses/LICENSE-2.0) +# * MIT license ([LICENSE-MIT](LICENSE-MIT) or +# http://opensource.org/licenses/MIT) +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. + +participants: + - el_type: nimbus + el_image: localtestnet + el_extra_params: ["--log-level=DEBUG"] + cl_type: nimbus + cl_image: statusim/nimbus-eth2:multiarch-latest + cl_extra_params: ["--log-level=DEBUG;INFO:gossip_eth2,attpool,libp2p,gossipsub,pubsubpeer,pubsub,switch,networking,sync,dialer,identify,syncman,connmanager,beacnde,lightcl,requman,gossip_lc,clearance,lpstream,mplexchannel,nodes-verification,tcptransport,chaindag,noise,eth,p2p,discv5,muxedupgrade,multistream,connection,secure,fee_recipient,mplex,syncpool,multiaddress,peer_proto;WARN:message_router"] + use_separate_vc: false +additional_services: + - tx_spammer + - assertoor + - beacon_metrics_gazer +tx_spammer_params: + tx_spammer_extra_args: ["--accounts=1", "--txcount=1"] +mev_type: null +assertoor_params: + image: "ethpandaops/assertoor:master" + run_stability_check: true + run_block_proposal_check: true + run_transaction_test: true + run_blob_transaction_test: false + run_opcodes_transaction_test: true diff --git a/kurtosis-network-params.yml b/kurtosis-network-params.yml new file mode 100644 index 000000000..9cf43ac30 --- /dev/null +++ b/kurtosis-network-params.yml @@ -0,0 +1,32 @@ +# Nimbus +# Copyright (c) 2018-2024 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or +# http://www.apache.org/licenses/LICENSE-2.0) +# * MIT license ([LICENSE-MIT](LICENSE-MIT) or +# http://opensource.org/licenses/MIT) +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. + +participants: + - el_type: nimbus + el_image: advaitanimbus/nimbus-builder-ci:master + el_extra_params: ["--log-level=DEBUG"] + cl_type: nimbus + cl_image: statusim/nimbus-eth2:multiarch-latest + cl_extra_params: ["--log-level=DEBUG;INFO:gossip_eth2,attpool,libp2p,gossipsub,pubsubpeer,pubsub,switch,networking,sync,dialer,identify,syncman,connmanager,beacnde,lightcl,requman,gossip_lc,clearance,lpstream,mplexchannel,nodes-verification,tcptransport,chaindag,noise,eth,p2p,discv5,muxedupgrade,multistream,connection,secure,fee_recipient,mplex,syncpool,multiaddress,peer_proto;WARN:message_router"] + use_separate_vc: false +additional_services: + - tx_spammer + - assertoor + - beacon_metrics_gazer +tx_spammer_params: + tx_spammer_extra_args: ["--accounts=1", "--txcount=1"] +mev_type: null +assertoor_params: + image: "ethpandaops/assertoor:master" + run_stability_check: true + run_block_proposal_check: true + run_transaction_test: true + run_blob_transaction_test: false + run_opcodes_transaction_test: true diff --git a/run-kurtosis-check.sh b/run-kurtosis-check.sh new file mode 100755 index 000000000..c83956ed2 --- /dev/null +++ b/run-kurtosis-check.sh @@ -0,0 +1,191 @@ +#!/bin/bash + +# Nimbus +# Copyright (c) 2018-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or +# http://www.apache.org/licenses/LICENSE-2.0) +# * MIT license ([LICENSE-MIT](LICENSE-MIT) or +# http://opensource.org/licenses/MIT) +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. + +# Checking for docker installation +echo "Checking docker installation" +if command -v docker &> /dev/null; then + echo "Docker installation found" +else + echo "Docker installation not found. Please install docker." + exit 1 +fi + +# Install jq if not installed already +if [ "$(dpkg -l | awk '/jq/ {print }'|wc -l)" -ge 1 ]; then + echo "jq is already installed" +else + echo "Installing jq" + sudo apt-get install -y jq +fi + +echo "Starting the Docker Build!" +# Build the docker Image +sudo docker build . -t localtestnet + +# The new el_image value +new_el_image="localtestnet" + +# Use sed to replace the el_image value in the file +cat kurtosis-network-params.yml | envsubst > assertoor.yaml +sed -i "s/el_image: .*/el_image: $new_el_image/" assertoor.yaml + +sudo kurtosis run \ + --enclave nimbus-localtestnet \ + github.com/kurtosis-tech/ethereum-package \ + --args-file assertoor.yaml + +assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep http | sed 's/.*\(http:\/\/[0-9.:]\+\).*/\1/') + +enclave_dump=$(kurtosis enclave inspect nimbus-localtestnet) +assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep http | sed 's/.*\(http:\/\/[0-9.:]\+\).*/\1/') +echo "Assertoor Checks Please Visit -> ${assertoor_url}" + +YELLOW='\033[1;33m' +GRAY='\033[0;37m' +GREEN='\033[0;32m' +RED='\033[0;31m' +NC='\033[0m' + +# print assertor logs +assertoor_container=$(docker container list | grep assertoor | sed 's/^\([^ ]\+\) .*$/\1/') +docker logs -f $assertoor_container & + +# helper to fetch task status for specific test id +get_tasks_status() { + tasks=$(curl -s ${assertoor_url}/api/v1/test_run/$1 | jq -c ".data.tasks[] | {index, parent_index, name, title, status, result}") + declare -A task_graph_map + task_graph_map[0]="" + + while read task; do + task_id=$(echo "$task" | jq -r ".index") + task_parent=$(echo "$task" | jq -r ".parent_index") + task_name=$(echo "$task" | jq -r ".name") + task_title=$(echo "$task" | jq -r ".title") + task_status=$(echo "$task" | jq -r ".status") + task_result=$(echo "$task" | jq -r ".result") + + task_graph="${task_graph_map[$task_parent]}" + task_graph_map[$task_id]="$task_graph |" + if [ ! -z "$task_graph" ]; then + task_graph="${task_graph}- " + fi + + if [ "$task_status" == "pending" ]; then + task_status="${GRAY}pending ${NC}" + elif [ "$task_status" == "running" ]; then + task_status="${YELLOW}running ${NC}" + elif [ "$task_status" == "complete" ]; then + task_status="${GREEN}complete${NC}" + fi + + if [ "$task_result" == "none" ]; then + task_result="${GRAY}none ${NC}" + elif [ "$task_result" == "success" ]; then + task_result="${GREEN}success${NC}" + elif [ "$task_result" == "failure" ]; then + task_result="${RED}failure${NC}" + fi + + echo -e " $(printf '%-4s' "$task_id")\t$task_status\t$task_result\t$(printf '%-50s' "$task_graph$task_name") \t$task_title" + done <<< $(echo "$tasks") +} + +# poll & check test status +final_test_result="" +failed_test_id="" +while true +do + pending_tests=0 + failed_tests=0 + total_tests=0 + running_test="" + + status_lines=() + task_lines="" + status_lines+=("$(date +'%Y-%m-%d %H:%M:%S') Test Status:") + + tests=$(curl -s ${assertoor_url}/api/v1/test_runs | jq -c ".data[] | {run_id, test_id, name, status}") + while read test; do + if [ -z "$test" ]; then + continue + fi + run_id=$(echo "$test" | jq -r ".run_id") + test_id=$(echo "$test" | jq -r ".test_id") + test_name=$(echo "$test" | jq -r ".name") + test_status=$(echo "$test" | jq -r ".status") + + if [ "$test_status" == "pending" ]; then + pending_tests=$(expr $pending_tests + 1) + status_name="${GRAY}pending${NC}" + elif [ "$test_status" == "running" ]; then + pending_tests=$(expr $pending_tests + 1) + running_test="$run_id" + status_name="${YELLOW}running${NC}" + + elif [ "$test_status" == "success" ]; then + status_name="${GREEN}success${NC}" + elif [ "$test_status" == "failure" ]; then + failed_tests=$(expr $failed_tests + 1) + failed_test_id="$run_id" + status_name="${RED}failure${NC}" + else + status_name="$test_status" + fi + status_lines+=(" $(printf '%-3s' "$test_id") $status_name \t$test_name") + total_tests=$(expr $total_tests + 1) + done <<< $(echo "$tests") + + for status_line in "${status_lines[@]}" + do + echo -e "$status_line" + done + + if ! [ -z "$running_test" ]; then + task_lines=$(get_tasks_status "$running_test") + echo "Active Test Task Status:" + echo "$task_lines" + fi + + if [ $failed_tests -gt 0 ]; then + final_test_result="failure" + break + fi + if [ $total_tests -gt 0 ] && [ $pending_tests -le 0 ]; then + final_test_result="success" + break + fi + + sleep 60 +done + +# save test results & status to github output +echo "test_result=$(echo "$final_test_result")" +echo "test_status" +for status_line in "${status_lines[@]}" +do + echo -e "$status_line" +done +echo "" + +if ! [ -z "$failed_test_id" ]; then + echo "failed_test_status" + get_tasks_status "$failed_test_id" + echo "" +else + echo "failed_test_status=" +fi + +# ------------------------------------------------ +# Cleanup +# ------------------------------------------------ +rm assertoor.yaml +sudo kurtosis enclave rm -f nimbus-localtestnet \ No newline at end of file From a058aa8dc1286787604c8043b3bbfc4db9fa9b70 Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Fri, 31 May 2024 16:20:44 +0530 Subject: [PATCH 02/14] fix: updated correct copyright year --- .dockerignore | 9 +++++++++ run-kurtosis-check.sh | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 208a59913..4e9619a07 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,10 @@ +# Nimbus +# Copyright (c) 2018-2024 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or +# http://www.apache.org/licenses/LICENSE-2.0) +# * MIT license ([LICENSE-MIT](LICENSE-MIT) or +# http://opensource.org/licenses/MIT) +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. vendor/* \ No newline at end of file diff --git a/run-kurtosis-check.sh b/run-kurtosis-check.sh index c83956ed2..10f2d165e 100755 --- a/run-kurtosis-check.sh +++ b/run-kurtosis-check.sh @@ -1,7 +1,7 @@ #!/bin/bash # Nimbus -# Copyright (c) 2018-2023 Status Research & Development GmbH +# Copyright (c) 2018-2024 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) From ef3010d63ff8845e4c0dd633b4cac8a525a8e3f7 Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Sun, 2 Jun 2024 11:54:34 +0530 Subject: [PATCH 03/14] fix: remove unwanted files, and introduce a post script cleanup --- assertoor.yaml | 32 -------------------------------- run-kurtosis-check.sh | 13 ++++++++++++- 2 files changed, 12 insertions(+), 33 deletions(-) delete mode 100644 assertoor.yaml diff --git a/assertoor.yaml b/assertoor.yaml deleted file mode 100644 index c81189831..000000000 --- a/assertoor.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Nimbus -# Copyright (c) 2018-2024 Status Research & Development GmbH -# Licensed under either of -# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or -# http://www.apache.org/licenses/LICENSE-2.0) -# * MIT license ([LICENSE-MIT](LICENSE-MIT) or -# http://opensource.org/licenses/MIT) -# at your option. This file may not be copied, modified, or distributed except -# according to those terms. - -participants: - - el_type: nimbus - el_image: localtestnet - el_extra_params: ["--log-level=DEBUG"] - cl_type: nimbus - cl_image: statusim/nimbus-eth2:multiarch-latest - cl_extra_params: ["--log-level=DEBUG;INFO:gossip_eth2,attpool,libp2p,gossipsub,pubsubpeer,pubsub,switch,networking,sync,dialer,identify,syncman,connmanager,beacnde,lightcl,requman,gossip_lc,clearance,lpstream,mplexchannel,nodes-verification,tcptransport,chaindag,noise,eth,p2p,discv5,muxedupgrade,multistream,connection,secure,fee_recipient,mplex,syncpool,multiaddress,peer_proto;WARN:message_router"] - use_separate_vc: false -additional_services: - - tx_spammer - - assertoor - - beacon_metrics_gazer -tx_spammer_params: - tx_spammer_extra_args: ["--accounts=1", "--txcount=1"] -mev_type: null -assertoor_params: - image: "ethpandaops/assertoor:master" - run_stability_check: true - run_block_proposal_check: true - run_transaction_test: true - run_blob_transaction_test: false - run_opcodes_transaction_test: true diff --git a/run-kurtosis-check.sh b/run-kurtosis-check.sh index 10f2d165e..e9b673ea0 100755 --- a/run-kurtosis-check.sh +++ b/run-kurtosis-check.sh @@ -10,6 +10,10 @@ # at your option. This file may not be copied, modified, or distributed except # according to those terms. +# ------------------------------------------------ +# Installation Checks +# ------------------------------------------------ + # Checking for docker installation echo "Checking docker installation" if command -v docker &> /dev/null; then @@ -49,6 +53,14 @@ enclave_dump=$(kurtosis enclave inspect nimbus-localtestnet) assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep http | sed 's/.*\(http:\/\/[0-9.:]\+\).*/\1/') echo "Assertoor Checks Please Visit -> ${assertoor_url}" +# ------------------------------------------------ +# Remove Generated File +# ------------------------------------------------ +rm assertoor.yaml + +# ------------------------------------------------ +# Check for Test Status +# ------------------------------------------------ YELLOW='\033[1;33m' GRAY='\033[0;37m' GREEN='\033[0;32m' @@ -187,5 +199,4 @@ fi # ------------------------------------------------ # Cleanup # ------------------------------------------------ -rm assertoor.yaml sudo kurtosis enclave rm -f nimbus-localtestnet \ No newline at end of file From 265130be2bc572260ca9d0f707e6f3ea99e55a84 Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Mon, 3 Jun 2024 12:43:11 +0530 Subject: [PATCH 04/14] fix: remove placeholder image-name & unwanted lines --- kurtosis-network-params.yml | 2 +- run-kurtosis-check.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/kurtosis-network-params.yml b/kurtosis-network-params.yml index 9cf43ac30..0f8ffe8e0 100644 --- a/kurtosis-network-params.yml +++ b/kurtosis-network-params.yml @@ -10,7 +10,7 @@ participants: - el_type: nimbus - el_image: advaitanimbus/nimbus-builder-ci:master + el_image: el_extra_params: ["--log-level=DEBUG"] cl_type: nimbus cl_image: statusim/nimbus-eth2:multiarch-latest diff --git a/run-kurtosis-check.sh b/run-kurtosis-check.sh index e9b673ea0..cc4667ce8 100755 --- a/run-kurtosis-check.sh +++ b/run-kurtosis-check.sh @@ -31,6 +31,9 @@ else sudo apt-get install -y jq fi +# ------------------------------------------------ +# Build the Docker Image +# ------------------------------------------------ echo "Starting the Docker Build!" # Build the docker Image sudo docker build . -t localtestnet @@ -38,6 +41,10 @@ sudo docker build . -t localtestnet # The new el_image value new_el_image="localtestnet" +# ------------------------------------------------ +# Run the Kurtosis Tests +# ------------------------------------------------ + # Use sed to replace the el_image value in the file cat kurtosis-network-params.yml | envsubst > assertoor.yaml sed -i "s/el_image: .*/el_image: $new_el_image/" assertoor.yaml @@ -47,8 +54,6 @@ sudo kurtosis run \ github.com/kurtosis-tech/ethereum-package \ --args-file assertoor.yaml -assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep http | sed 's/.*\(http:\/\/[0-9.:]\+\).*/\1/') - enclave_dump=$(kurtosis enclave inspect nimbus-localtestnet) assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep http | sed 's/.*\(http:\/\/[0-9.:]\+\).*/\1/') echo "Assertoor Checks Please Visit -> ${assertoor_url}" From 7227077002da5ceea582add159b54f35f1bb4a2c Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Mon, 3 Jun 2024 14:30:12 +0530 Subject: [PATCH 05/14] fix: check for jq shifted from dpkg --- run-kurtosis-check.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/run-kurtosis-check.sh b/run-kurtosis-check.sh index cc4667ce8..8d3ffb2f6 100755 --- a/run-kurtosis-check.sh +++ b/run-kurtosis-check.sh @@ -24,10 +24,11 @@ else fi # Install jq if not installed already -if [ "$(dpkg -l | awk '/jq/ {print }'|wc -l)" -ge 1 ]; then - echo "jq is already installed" +if [ "$(which jq)" != "" ]; +then + echo "jq is already installed" else - echo "Installing jq" + echo "jq is not installed. Installing jq" sudo apt-get install -y jq fi From 1272815f86897798156b30d24f04c9f08e2859cc Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Wed, 5 Jun 2024 11:58:46 +0530 Subject: [PATCH 06/14] changed copyright year to 2024 --- .dockerignore | 2 +- Dockerfile | 6 +++--- kurtosis-network-params.yml | 2 +- run-kurtosis-check.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 4e9619a07..a7f29fa58 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2018-2024 Status Research & Development GmbH +# Copyright (c) 2024 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) diff --git a/Dockerfile b/Dockerfile index 20550a89a..0c43ef997 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2018-2024 Status Research & Development GmbH +# Copyright (c) 2024 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) @@ -13,7 +13,7 @@ FROM debian:testing-slim AS build SHELL ["/bin/bash", "-c"] RUN apt-get clean && apt update \ - && apt -y install build-essential git-lfs librocksdb-dev libpcre3-dev + && apt -y install build-essential git-lfs librocksdb-dev RUN ldd --version ldd @@ -30,7 +30,7 @@ FROM debian:testing-slim as deploy SHELL ["/bin/bash", "-c"] RUN apt-get clean && apt update \ - && apt -y install build-essential librocksdb-dev libpcre3-dev + && apt -y install build-essential librocksdb-dev RUN apt update && apt -y upgrade RUN ldd --version ldd diff --git a/kurtosis-network-params.yml b/kurtosis-network-params.yml index 0f8ffe8e0..2cb23a924 100644 --- a/kurtosis-network-params.yml +++ b/kurtosis-network-params.yml @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2018-2024 Status Research & Development GmbH +# Copyright (c) 2024 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) diff --git a/run-kurtosis-check.sh b/run-kurtosis-check.sh index 8d3ffb2f6..6e9ff99a5 100755 --- a/run-kurtosis-check.sh +++ b/run-kurtosis-check.sh @@ -1,7 +1,7 @@ #!/bin/bash # Nimbus -# Copyright (c) 2018-2024 Status Research & Development GmbH +# Copyright (c) 2024 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) From 8ddc38dee9ab805ba6f4e622e003d643f1c01d63 Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Wed, 5 Jun 2024 14:25:51 +0530 Subject: [PATCH 07/14] add optimizations and optional features --- run-kurtosis-check.sh | 329 ++++++++++++++++++++++++------------------ 1 file changed, 187 insertions(+), 142 deletions(-) diff --git a/run-kurtosis-check.sh b/run-kurtosis-check.sh index 6e9ff99a5..555eda2e6 100755 --- a/run-kurtosis-check.sh +++ b/run-kurtosis-check.sh @@ -10,6 +10,17 @@ # at your option. This file may not be copied, modified, or distributed except # according to those terms. +# ------------------------------------------------ +# Inputs on how to run checks +# ------------------------------------------------ +echo +echo -n "Do you want to run the checks in terminal or visit the assertoor URL? (terminal/url) " +read reply + +echo +echo -n "Build new changes (yes/no)? " +read use_previous_image + # ------------------------------------------------ # Installation Checks # ------------------------------------------------ @@ -17,30 +28,54 @@ # Checking for docker installation echo "Checking docker installation" if command -v docker &> /dev/null; then - echo "Docker installation found" + echo "Docker installation found" else - echo "Docker installation not found. Please install docker." - exit 1 + echo "Docker installation not found. Please install docker." + exit 1 +fi + +echo "Checking kurtosis installation" +if command -v kurtosis &> /dev/null; then + echo "Kurtosis installation found" +else + echo "Kurtosis installation not found. Installing kurtosis" + echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list + sudo apt-get update + sudo apt-get install -y kurtosis fi # Install jq if not installed already if [ "$(which jq)" != "" ]; then - echo "jq is already installed" + echo "jq is already installed" else - echo "jq is not installed. Installing jq" - sudo apt-get install -y jq + echo "jq is not installed. Installing jq" + sudo apt-get install -y jq fi +new_el_image="localtestnet" + # ------------------------------------------------ # Build the Docker Image # ------------------------------------------------ -echo "Starting the Docker Build!" -# Build the docker Image -sudo docker build . -t localtestnet +if [[ "$use_previous_image" == "no" ]]; then + echo "Using the previously built docker image" + echo + echo -n "Please enter the docker image name (default: localtestnet) " + read -r el_image + if [[ "$el_image" == "" ]]; then + new_el_image="localtestnet" + else + new_el_image=$el_image + fi +else + echo "Starting the Docker Build!" + # Build the docker Image + sudo docker build . -t localtestnet + # The new el_image value + new_el_image="localtestnet" +fi -# The new el_image value -new_el_image="localtestnet" # ------------------------------------------------ # Run the Kurtosis Tests @@ -57,152 +92,162 @@ sudo kurtosis run \ enclave_dump=$(kurtosis enclave inspect nimbus-localtestnet) assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep http | sed 's/.*\(http:\/\/[0-9.:]\+\).*/\1/') -echo "Assertoor Checks Please Visit -> ${assertoor_url}" # ------------------------------------------------ # Remove Generated File # ------------------------------------------------ rm assertoor.yaml -# ------------------------------------------------ -# Check for Test Status -# ------------------------------------------------ -YELLOW='\033[1;33m' -GRAY='\033[0;37m' -GREEN='\033[0;32m' -RED='\033[0;31m' -NC='\033[0m' - -# print assertor logs -assertoor_container=$(docker container list | grep assertoor | sed 's/^\([^ ]\+\) .*$/\1/') -docker logs -f $assertoor_container & - -# helper to fetch task status for specific test id -get_tasks_status() { - tasks=$(curl -s ${assertoor_url}/api/v1/test_run/$1 | jq -c ".data.tasks[] | {index, parent_index, name, title, status, result}") - declare -A task_graph_map - task_graph_map[0]="" - - while read task; do - task_id=$(echo "$task" | jq -r ".index") - task_parent=$(echo "$task" | jq -r ".parent_index") - task_name=$(echo "$task" | jq -r ".name") - task_title=$(echo "$task" | jq -r ".title") - task_status=$(echo "$task" | jq -r ".status") - task_result=$(echo "$task" | jq -r ".result") - - task_graph="${task_graph_map[$task_parent]}" - task_graph_map[$task_id]="$task_graph |" - if [ ! -z "$task_graph" ]; then - task_graph="${task_graph}- " - fi - - if [ "$task_status" == "pending" ]; then - task_status="${GRAY}pending ${NC}" - elif [ "$task_status" == "running" ]; then - task_status="${YELLOW}running ${NC}" - elif [ "$task_status" == "complete" ]; then - task_status="${GREEN}complete${NC}" +# Check the user's input and respond accordingly +if [[ "$reply" == "url" ]]; then + echo "You chose to visit the assertoor URL." + echo "Assertoor Checks Please Visit -> ${assertoor_url}" + echo "Please visit the URL to check the status of the tests" + echo "The kurtosis enclave needs to be cleared, after the tests are done. Please run the following command ----- sudo kurtosis enclave rm -f nimbus-localtestnet" +else + echo "Running the checks over terminal" + + + # ------------------------------------------------ + # Check for Test Status + # ------------------------------------------------ + YELLOW='\033[1;33m' + GRAY='\033[0;37m' + GREEN='\033[0;32m' + RED='\033[0;31m' + NC='\033[0m' + + # print assertor logs + assertoor_container=$(docker container list | grep assertoor | sed 's/^\([^ ]\+\) .*$/\1/') + docker logs -f $assertoor_container & + + # helper to fetch task status for specific test id + get_tasks_status() { + tasks=$(curl -s ${assertoor_url}/api/v1/test_run/$1 | jq -c ".data.tasks[] | {index, parent_index, name, title, status, result}") + declare -A task_graph_map + task_graph_map[0]="" + + while read task; do + task_id=$(echo "$task" | jq -r ".index") + task_parent=$(echo "$task" | jq -r ".parent_index") + task_name=$(echo "$task" | jq -r ".name") + task_title=$(echo "$task" | jq -r ".title") + task_status=$(echo "$task" | jq -r ".status") + task_result=$(echo "$task" | jq -r ".result") + + task_graph="${task_graph_map[$task_parent]}" + task_graph_map[$task_id]="$task_graph |" + if [ ! -z "$task_graph" ]; then + task_graph="${task_graph}- " + fi + + if [ "$task_status" == "pending" ]; then + task_status="${GRAY}pending ${NC}" + elif [ "$task_status" == "running" ]; then + task_status="${YELLOW}running ${NC}" + elif [ "$task_status" == "complete" ]; then + task_status="${GREEN}complete${NC}" + fi + + if [ "$task_result" == "none" ]; then + task_result="${GRAY}none ${NC}" + elif [ "$task_result" == "success" ]; then + task_result="${GREEN}success${NC}" + elif [ "$task_result" == "failure" ]; then + task_result="${RED}failure${NC}" + fi + + echo -e " $(printf '%-4s' "$task_id")\t$task_status\t$task_result\t$(printf '%-50s' "$task_graph$task_name") \t$task_title" + done <<< $(echo "$tasks") + } + + # poll & check test status + final_test_result="" + failed_test_id="" + while true + do + pending_tests=0 + failed_tests=0 + total_tests=0 + running_test="" + + status_lines=() + task_lines="" + status_lines+=("$(date +'%Y-%m-%d %H:%M:%S') Test Status:") + + tests=$(curl -s ${assertoor_url}/api/v1/test_runs | jq -c ".data[] | {run_id, test_id, name, status}") + while read test; do + if [ -z "$test" ]; then + continue + fi + run_id=$(echo "$test" | jq -r ".run_id") + test_id=$(echo "$test" | jq -r ".test_id") + test_name=$(echo "$test" | jq -r ".name") + test_status=$(echo "$test" | jq -r ".status") + + if [ "$test_status" == "pending" ]; then + pending_tests=$(expr $pending_tests + 1) + status_name="${GRAY}pending${NC}" + elif [ "$test_status" == "running" ]; then + pending_tests=$(expr $pending_tests + 1) + running_test="$run_id" + status_name="${YELLOW}running${NC}" + + elif [ "$test_status" == "success" ]; then + status_name="${GREEN}success${NC}" + elif [ "$test_status" == "failure" ]; then + failed_tests=$(expr $failed_tests + 1) + failed_test_id="$run_id" + status_name="${RED}failure${NC}" + else + status_name="$test_status" + fi + status_lines+=(" $(printf '%-3s' "$test_id") $status_name \t$test_name") + total_tests=$(expr $total_tests + 1) + done <<< $(echo "$tests") + + for status_line in "${status_lines[@]}" + do + echo -e "$status_line" + done + + if ! [ -z "$running_test" ]; then + task_lines=$(get_tasks_status "$running_test") + echo "Active Test Task Status:" + echo "$task_lines" fi - if [ "$task_result" == "none" ]; then - task_result="${GRAY}none ${NC}" - elif [ "$task_result" == "success" ]; then - task_result="${GREEN}success${NC}" - elif [ "$task_result" == "failure" ]; then - task_result="${RED}failure${NC}" - fi - - echo -e " $(printf '%-4s' "$task_id")\t$task_status\t$task_result\t$(printf '%-50s' "$task_graph$task_name") \t$task_title" - done <<< $(echo "$tasks") -} - -# poll & check test status -final_test_result="" -failed_test_id="" -while true -do - pending_tests=0 - failed_tests=0 - total_tests=0 - running_test="" - - status_lines=() - task_lines="" - status_lines+=("$(date +'%Y-%m-%d %H:%M:%S') Test Status:") - - tests=$(curl -s ${assertoor_url}/api/v1/test_runs | jq -c ".data[] | {run_id, test_id, name, status}") - while read test; do - if [ -z "$test" ]; then - continue + if [ $failed_tests -gt 0 ]; then + final_test_result="failure" + break fi - run_id=$(echo "$test" | jq -r ".run_id") - test_id=$(echo "$test" | jq -r ".test_id") - test_name=$(echo "$test" | jq -r ".name") - test_status=$(echo "$test" | jq -r ".status") - - if [ "$test_status" == "pending" ]; then - pending_tests=$(expr $pending_tests + 1) - status_name="${GRAY}pending${NC}" - elif [ "$test_status" == "running" ]; then - pending_tests=$(expr $pending_tests + 1) - running_test="$run_id" - status_name="${YELLOW}running${NC}" - - elif [ "$test_status" == "success" ]; then - status_name="${GREEN}success${NC}" - elif [ "$test_status" == "failure" ]; then - failed_tests=$(expr $failed_tests + 1) - failed_test_id="$run_id" - status_name="${RED}failure${NC}" - else - status_name="$test_status" + if [ $total_tests -gt 0 ] && [ $pending_tests -le 0 ]; then + final_test_result="success" + break fi - status_lines+=(" $(printf '%-3s' "$test_id") $status_name \t$test_name") - total_tests=$(expr $total_tests + 1) - done <<< $(echo "$tests") + sleep 60 + done + + # save test results & status to github output + echo "test_result=$(echo "$final_test_result")" + echo "test_status" for status_line in "${status_lines[@]}" do echo -e "$status_line" done + echo "" - if ! [ -z "$running_test" ]; then - task_lines=$(get_tasks_status "$running_test") - echo "Active Test Task Status:" - echo "$task_lines" - fi - - if [ $failed_tests -gt 0 ]; then - final_test_result="failure" - break - fi - if [ $total_tests -gt 0 ] && [ $pending_tests -le 0 ]; then - final_test_result="success" - break + if ! [ -z "$failed_test_id" ]; then + echo "failed_test_status" + get_tasks_status "$failed_test_id" + echo "" + else + echo "failed_test_status=" fi - sleep 60 -done - -# save test results & status to github output -echo "test_result=$(echo "$final_test_result")" -echo "test_status" -for status_line in "${status_lines[@]}" -do - echo -e "$status_line" -done -echo "" - -if ! [ -z "$failed_test_id" ]; then - echo "failed_test_status" - get_tasks_status "$failed_test_id" - echo "" -else - echo "failed_test_status=" -fi - -# ------------------------------------------------ -# Cleanup -# ------------------------------------------------ -sudo kurtosis enclave rm -f nimbus-localtestnet \ No newline at end of file + # ------------------------------------------------ + # Cleanup + # ------------------------------------------------ + sudo kurtosis enclave rm -f nimbus-localtestnet +fi \ No newline at end of file From cfbcbe9face63ec37152def6afabe7d3f2bb4314 Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Thu, 6 Jun 2024 02:35:29 +0530 Subject: [PATCH 08/14] feat: kurtosis CI for eth1-eth2 interop --- .github/workflows/kurtosis.yml | 258 +++++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 .github/workflows/kurtosis.yml diff --git a/.github/workflows/kurtosis.yml b/.github/workflows/kurtosis.yml new file mode 100644 index 000000000..8bf35b4a0 --- /dev/null +++ b/.github/workflows/kurtosis.yml @@ -0,0 +1,258 @@ +# Nimbus +# Copyright (c) 2024 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or +# http://www.apache.org/licenses/LICENSE-2.0) +# * MIT license ([LICENSE-MIT](LICENSE-MIT) or +# http://opensource.org/licenses/MIT) +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. + +name: Kurtosis Assertoor Tests + +on: + push: + branches: + - master + +jobs: + build: + name: Nimbue eth1 - eth2 compatibility check + outputs: + test_result: ${{ steps.test_result.outputs.test_result }} + test_status: ${{ steps.test_result.outputs.test_status }} + failed_test_status: ${{ steps.test_result.outputs.failed_test_status }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Docker image + shell: bash + run: docker build . -t localtestnet + + + - name: Setup Kurtosis + shell: bash + run: | + echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list + sudo apt update + sudo apt install kurtosis-cli + kurtosis analytics disable + + - name: Run Kurtosis + shell: bash + id: services + run: | + export github_sha=${{ github.sha }} + export github_repository=${{ github.repository }} + + cat kurtosis-network-params.yml | envsubst > assertoor.yaml + sed -i "s/el_image: .*/el_image: localtestnet/" assertoor.yaml + + kurtosis run github.com/kurtosis-tech/ethereum-package --enclave assertoor-${{ github.run_id }} --args-file assertoor.yaml + + enclave_dump=$(kurtosis enclave inspect assertoor-${{ github.run_id }}) + + assertoor_url=$(echo "$enclave_dump" | grep assertoor | grep http | sed 's/.*\(http:\/\/[0-9.:]\+\).*/\1/') + echo "assertoor_url: ${assertoor_url}" + echo "assertoor_url=${assertoor_url}" >> $GITHUB_OUTPUT + + - name: Await test completion + shell: bash + id: test_result + run: | + assertoor_url="${{ steps.services.outputs.assertoor_url }}" + + YELLOW='\033[1;33m' + GRAY='\033[0;37m' + GREEN='\033[0;32m' + RED='\033[0;31m' + NC='\033[0m' + + # print assertor logs + assertoor_container=$(docker container list | grep assertoor | sed 's/^\([^ ]\+\) .*$/\1/') + docker logs -f $assertoor_container & + + # helper to fetch task status for specific test id + get_tasks_status() { + tasks=$(curl -s ${assertoor_url}/api/v1/test_run/$1 | jq -c ".data.tasks[] | {index, parent_index, name, title, status, result}") + declare -A task_graph_map + task_graph_map[0]="" + + while read task; do + task_id=$(echo "$task" | jq -r ".index") + task_parent=$(echo "$task" | jq -r ".parent_index") + task_name=$(echo "$task" | jq -r ".name") + task_title=$(echo "$task" | jq -r ".title") + task_status=$(echo "$task" | jq -r ".status") + task_result=$(echo "$task" | jq -r ".result") + + task_graph="${task_graph_map[$task_parent]}" + task_graph_map[$task_id]="$task_graph |" + if [ ! -z "$task_graph" ]; then + task_graph="${task_graph}- " + fi + + if [ "$task_status" == "pending" ]; then + task_status="${GRAY}pending ${NC}" + elif [ "$task_status" == "running" ]; then + task_status="${YELLOW}running ${NC}" + elif [ "$task_status" == "complete" ]; then + task_status="${GREEN}complete${NC}" + fi + + if [ "$task_result" == "none" ]; then + task_result="${GRAY}none ${NC}" + elif [ "$task_result" == "success" ]; then + task_result="${GREEN}success${NC}" + elif [ "$task_result" == "failure" ]; then + task_result="${RED}failure${NC}" + fi + + echo -e " $(printf '%-4s' "$task_id")\t$task_status\t$task_result\t$(printf '%-50s' "$task_graph$task_name") \t$task_title" + done <<< $(echo "$tasks") + } + + # poll & check test status + final_test_result="" + failed_test_id="" + while true + do + pending_tests=0 + failed_tests=0 + total_tests=0 + running_test="" + + status_lines=() + task_lines="" + status_lines+=("$(date +'%Y-%m-%d %H:%M:%S') Test Status:") + + tests=$(curl -s ${assertoor_url}/api/v1/test_runs | jq -c ".data[] | {run_id, test_id, name, status}") + while read test; do + if [ -z "$test" ]; then + continue + fi + run_id=$(echo "$test" | jq -r ".run_id") + test_id=$(echo "$test" | jq -r ".test_id") + test_name=$(echo "$test" | jq -r ".name") + test_status=$(echo "$test" | jq -r ".status") + + if [ "$test_status" == "pending" ]; then + pending_tests=$(expr $pending_tests + 1) + status_name="${GRAY}pending${NC}" + elif [ "$test_status" == "running" ]; then + pending_tests=$(expr $pending_tests + 1) + running_test="$run_id" + status_name="${YELLOW}running${NC}" + + elif [ "$test_status" == "success" ]; then + status_name="${GREEN}success${NC}" + elif [ "$test_status" == "failure" ]; then + failed_tests=$(expr $failed_tests + 1) + failed_test_id="$run_id" + status_name="${RED}failure${NC}" + else + status_name="$test_status" + fi + status_lines+=(" $(printf '%-3s' "$test_id") $status_name \t$test_name") + total_tests=$(expr $total_tests + 1) + done <<< $(echo "$tests") + + for status_line in "${status_lines[@]}" + do + echo -e "$status_line" + done + + if ! [ -z "$running_test" ]; then + task_lines=$(get_tasks_status "$running_test") + echo "Active Test Task Status:" + echo "$task_lines" + fi + + if [ $failed_tests -gt 0 ]; then + final_test_result="failure" + break + fi + if [ $total_tests -gt 0 ] && [ $pending_tests -le 0 ]; then + final_test_result="success" + break + fi + + sleep 60 + done + + # save test results & status to github output + echo "test_result=$(echo "$final_test_result")" >> $GITHUB_OUTPUT + echo "test_status<> $GITHUB_OUTPUT + for status_line in "${status_lines[@]}" + do + echo -e "$status_line" >> $GITHUB_OUTPUT + done + echo "EOF" >> $GITHUB_OUTPUT + + if ! [ -z "$failed_test_id" ]; then + echo "failed_test_status<> $GITHUB_OUTPUT + get_tasks_status "$failed_test_id" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + else + echo "failed_test_status=" >> $GITHUB_OUTPUT + fi + + - name: Generate dump and remove kurtosis enclave + shell: bash + run: | + mkdir -p ./temp/dump + cd ./temp/dump + cp ../../assertoor.yaml ./kurtosis-params.yaml + + kurtosis enclave dump assertoor-${{ github.run_id }} + kurtosis enclave rm -f assertoor-${{ github.run_id }} + + - name: Upload dump artifact + uses: actions/upload-artifact@v4 + with: + name: "kurtosis-enclave-dump-${{ github.run_id }}" + path: ./temp/dump + + - name: Return test result + shell: bash + run: | + test_result="${{ steps.test_result.outputs.test_result }}" + test_status=$( + cat <<"EOF" + ${{ steps.test_result.outputs.test_status }} + EOF + ) + failed_test_status=$( + cat <<"EOF" + ${{ steps.test_result.outputs.failed_test_status }} + EOF + ) + + echo "Test Result: $test_result" + echo "$test_status" + + if ! [ "$test_result" == "success" ]; then + echo "" + echo "Failed Test Task Status:" + echo "$failed_test_status" + + echo "" + echo "See 'Await test completion' task for detailed logs about this failure!" + echo "" + + exit 1 # fail action + fi \ No newline at end of file From 4bd33d7777a50ccff4ed8de1c991ea981528b084 Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Thu, 6 Jun 2024 02:38:55 +0530 Subject: [PATCH 09/14] fix: added to run on PRs --- .github/workflows/kurtosis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/kurtosis.yml b/.github/workflows/kurtosis.yml index 8bf35b4a0..5d6f72295 100644 --- a/.github/workflows/kurtosis.yml +++ b/.github/workflows/kurtosis.yml @@ -14,6 +14,9 @@ on: push: branches: - master + pull_request: + branches: + - master jobs: build: From 57a52ccb6cefeda4b94f7cab2331a30824839e95 Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Thu, 6 Jun 2024 03:01:51 +0530 Subject: [PATCH 10/14] fix: curl installation missing in docker --- .github/workflows/kurtosis.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kurtosis.yml b/.github/workflows/kurtosis.yml index 5d6f72295..0443a2bd0 100644 --- a/.github/workflows/kurtosis.yml +++ b/.github/workflows/kurtosis.yml @@ -8,7 +8,7 @@ # at your option. This file may not be copied, modified, or distributed except # according to those terms. -name: Kurtosis Assertoor Tests +name: Kurtosis Tests on: push: diff --git a/Dockerfile b/Dockerfile index 0c43ef997..692e5381c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ FROM debian:testing-slim AS build SHELL ["/bin/bash", "-c"] RUN apt-get clean && apt update \ - && apt -y install build-essential git-lfs librocksdb-dev + && apt -y install curl build-essential git-lfs librocksdb-dev RUN ldd --version ldd From a136f38836849d1bf04b23c4ad359b694497636f Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Sun, 9 Jun 2024 15:33:24 +0530 Subject: [PATCH 11/14] fix: shellcheck fixed with suggested changes --- .github/workflows/kurtosis.yml | 4 ++-- run-kurtosis-check.sh | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/kurtosis.yml b/.github/workflows/kurtosis.yml index 0443a2bd0..f54e5a1b4 100644 --- a/.github/workflows/kurtosis.yml +++ b/.github/workflows/kurtosis.yml @@ -20,7 +20,7 @@ on: jobs: build: - name: Nimbue eth1 - eth2 compatibility check + name: Nimbus eth1 - eth2 interop check outputs: test_result: ${{ steps.test_result.outputs.test_result }} test_status: ${{ steps.test_result.outputs.test_status }} @@ -47,7 +47,7 @@ jobs: run: docker build . -t localtestnet - - name: Setup Kurtosis + - name: Set up Kurtosis shell: bash run: | echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list diff --git a/run-kurtosis-check.sh b/run-kurtosis-check.sh index 555eda2e6..b0bc7fe12 100755 --- a/run-kurtosis-check.sh +++ b/run-kurtosis-check.sh @@ -14,11 +14,11 @@ # Inputs on how to run checks # ------------------------------------------------ echo -echo -n "Do you want to run the checks in terminal or visit the assertoor URL? (terminal/url) " +printf "Do you want to run the checks in terminal or visit the assertoor URL? (terminal/url) " read reply echo -echo -n "Build new changes (yes/no)? " +printf "Build new changes (yes/no)? " read use_previous_image # ------------------------------------------------ @@ -119,11 +119,11 @@ else # print assertor logs assertoor_container=$(docker container list | grep assertoor | sed 's/^\([^ ]\+\) .*$/\1/') - docker logs -f $assertoor_container & + docker logs -f "$assertoor_container" & # helper to fetch task status for specific test id get_tasks_status() { - tasks=$(curl -s ${assertoor_url}/api/v1/test_run/$1 | jq -c ".data.tasks[] | {index, parent_index, name, title, status, result}") + tasks=$(curl -s "${assertoor_url}"/api/v1/test_run/"$1" | jq -c ".data.tasks[] | {index, parent_index, name, title, status, result}") declare -A task_graph_map task_graph_map[0]="" @@ -175,7 +175,7 @@ else task_lines="" status_lines+=("$(date +'%Y-%m-%d %H:%M:%S') Test Status:") - tests=$(curl -s ${assertoor_url}/api/v1/test_runs | jq -c ".data[] | {run_id, test_id, name, status}") + tests=$(curl -s "${assertoor_url}"/api/v1/test_runs | jq -c ".data[] | {run_id, test_id, name, status}") while read test; do if [ -z "$test" ]; then continue @@ -217,11 +217,11 @@ else echo "$task_lines" fi - if [ $failed_tests -gt 0 ]; then + if [ "$failed_tests" -gt 0 ]; then final_test_result="failure" break fi - if [ $total_tests -gt 0 ] && [ $pending_tests -le 0 ]; then + if [ "$total_tests" -gt 0 ] && [ "$pending_tests" -le 0 ]; then final_test_result="success" break fi @@ -236,7 +236,7 @@ else do echo -e "$status_line" done - echo "" + echo if ! [ -z "$failed_test_id" ]; then echo "failed_test_status" From 5a9284f49879ec69e27105b600995c90fd75c85c Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Sun, 9 Jun 2024 15:38:37 +0530 Subject: [PATCH 12/14] changed tests to fail(github) on success --- .github/workflows/kurtosis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kurtosis.yml b/.github/workflows/kurtosis.yml index f54e5a1b4..e91b50f78 100644 --- a/.github/workflows/kurtosis.yml +++ b/.github/workflows/kurtosis.yml @@ -248,7 +248,7 @@ jobs: echo "Test Result: $test_result" echo "$test_status" - if ! [ "$test_result" == "success" ]; then + if [ "$test_result" == "success" ]; then echo "" echo "Failed Test Task Status:" echo "$failed_test_status" From afe759fb319a5d9a60fbae1bae5790fceb68317d Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Mon, 10 Jun 2024 04:30:20 +0530 Subject: [PATCH 13/14] fix: changed from -rf to -f in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 692e5381c..15a86b7de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN apt update && apt -y upgrade RUN ldd --version ldd -RUN rm -rf /home/user/nimbus-eth1/build/nimbus +RUN rm -f /home/user/nimbus-eth1/build/nimbus COPY --from=build /root/nimbus-eth1/build/nimbus /home/user/nimbus-eth1/build/nimbus From 9b5674e56325c29a4fa8cdf4e11368b41723f75a Mon Sep 17 00:00:00 2001 From: advaita-saha Date: Mon, 10 Jun 2024 12:27:31 +0530 Subject: [PATCH 14/14] fix: removed echo -e --- .github/workflows/kurtosis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/kurtosis.yml b/.github/workflows/kurtosis.yml index e91b50f78..ad09af91e 100644 --- a/.github/workflows/kurtosis.yml +++ b/.github/workflows/kurtosis.yml @@ -125,7 +125,7 @@ jobs: task_result="${RED}failure${NC}" fi - echo -e " $(printf '%-4s' "$task_id")\t$task_status\t$task_result\t$(printf '%-50s' "$task_graph$task_name") \t$task_title" + printf " $(printf '%-4s' "$task_id")\t$task_status\t$task_result\t$(printf '%-50s' "$task_graph$task_name") \t$task_title \n" done <<< $(echo "$tasks") } @@ -176,7 +176,7 @@ jobs: for status_line in "${status_lines[@]}" do - echo -e "$status_line" + printf "$status_line \n" done if ! [ -z "$running_test" ]; then @@ -202,7 +202,7 @@ jobs: echo "test_status<> $GITHUB_OUTPUT for status_line in "${status_lines[@]}" do - echo -e "$status_line" >> $GITHUB_OUTPUT + printf "$status_line \n" >> $GITHUB_OUTPUT done echo "EOF" >> $GITHUB_OUTPUT