From d03cf339be603c8020eb35fbabcfe781ab26920e Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Mon, 21 Jun 2021 21:14:20 -0600 Subject: [PATCH 1/6] ci: use versioned cargo wrapper for crate ordering (cherry picked from commit 554002b73cc16130a723ed9bc39494b772e1fea5) --- ci/order-crates-for-publishing.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ci/order-crates-for-publishing.py b/ci/order-crates-for-publishing.py index efa5e0aca33463..05f572b2a912a8 100755 --- a/ci/order-crates-for-publishing.py +++ b/ci/order-crates-for-publishing.py @@ -12,10 +12,14 @@ import subprocess import sys; +real_file = os.path.realpath(__file__) +ci_path = os.path.dirname(real_file) +src_root = os.path.dirname(ci_path) + def load_metadata(): + cmd = f'{src_root}/cargo metadata --no-deps --format-version=1' return json.loads(subprocess.Popen( - 'cargo metadata --no-deps --format-version=1', - shell=True, stdout=subprocess.PIPE).communicate()[0]) + cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]) def get_packages(): metadata = load_metadata() From 68360911e2a12ecc4b3610cebaa8989211730987 Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Mon, 21 Jun 2021 21:17:04 -0600 Subject: [PATCH 2/6] ci: nvidia persistence mode isn't a hard requirement (cherry picked from commit f213e48067a38e1c93d45e4de190201060990777) --- ci/test-stable.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/test-stable.sh b/ci/test-stable.sh index e3e6aaabad0ab8..60264b5a9205d5 100755 --- a/ci/test-stable.sh +++ b/ci/test-stable.sh @@ -57,7 +57,7 @@ test-stable-perf) # Enable persistence mode to keep the CUDA kernel driver loaded, avoiding a # lengthy and unexpected delay the first time CUDA is involved when the driver # is not yet loaded. - sudo --non-interactive ./net/scripts/enable-nvidia-persistence-mode.sh + sudo --non-interactive ./net/scripts/enable-nvidia-persistence-mode.sh || true rm -rf target/perf-libs ./fetch-perf-libs.sh From 251e0deac53e9c3a58669e53bdae7c3d704fbc47 Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Mon, 21 Jun 2021 21:19:19 -0600 Subject: [PATCH 3/6] sdk: ensure `ld` can find criterion when running BPF tests (cherry picked from commit 7ee39fcb0f9e77cf3e0a6d7ba50f6b39de799475) --- sdk/bpf/c/bpf.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/bpf/c/bpf.mk b/sdk/bpf/c/bpf.mk index a926fdfea14921..1711564b196d5d 100644 --- a/sdk/bpf/c/bpf.mk +++ b/sdk/bpf/c/bpf.mk @@ -194,6 +194,7 @@ endef define TEST_EXEC_RULE $1: $2 + LD_LIBRARY_PATH=$(TESTFRAMEWORK_RPATH) \ $2$(\n) endef From 5669e877a668275aff138f41a54f58ccd972363a Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Mon, 21 Jun 2021 21:20:18 -0600 Subject: [PATCH 4/6] ci: give localnet nodes a more time to startup (cherry picked from commit 278a241db33491241d74ff63c2f1773f5a6c7a6b) --- ci/localnet-sanity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/localnet-sanity.sh b/ci/localnet-sanity.sh index d5dbf12a56e90b..f827c0443f5235 100755 --- a/ci/localnet-sanity.sh +++ b/ci/localnet-sanity.sh @@ -127,7 +127,7 @@ startNode() { waitForNodeToInit() { declare initCompleteFile=$1 while [[ ! -r $initCompleteFile ]]; do - if [[ $SECONDS -ge 240 ]]; then + if [[ $SECONDS -ge 300 ]]; then echo "^^^ +++" echo "Error: $initCompleteFile not found in $SECONDS seconds" exit 1 From df599a16dd81fa7e7a5dfbf4b9b3280c841317b5 Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Mon, 21 Jun 2021 21:20:45 -0600 Subject: [PATCH 5/6] ci: add downstream build wrapper (cherry picked from commit 761e3249821d3fbb1e58151fc6c4093e8d0e6fa5) --- ci/test-downstream-builds.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 ci/test-downstream-builds.sh diff --git a/ci/test-downstream-builds.sh b/ci/test-downstream-builds.sh new file mode 100755 index 00000000000000..0a45db80d2b0bc --- /dev/null +++ b/ci/test-downstream-builds.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")/.." + +export CI_LOCAL_RUN=true + +set -ex + +scripts/build-downstream-projects.sh From ac49ded192d55c454d9f3d74e87e90bf43fa3ded Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Mon, 21 Jun 2021 21:21:42 -0600 Subject: [PATCH 6/6] ci: add wrapper script for running ci locally Linux only for now (cherry picked from commit 0bc38153ca0e5160915c59f1148fb8efffbbd856) --- ci/env.sh | 5 ++++- ci/run-local.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100755 ci/run-local.sh diff --git a/ci/env.sh b/ci/env.sh index d075b259997020..df7ed1ce6aeb32 100644 --- a/ci/env.sh +++ b/ci/env.sh @@ -74,10 +74,13 @@ else export CI_BUILD_ID= export CI_COMMIT= export CI_JOB_ID= - export CI_OS_NAME= export CI_PULL_REQUEST= export CI_REPO_SLUG= export CI_TAG= + # Don't override ci/run-local.sh + if [[ -z $CL_LOCAL_RUN ]]; then + export CI_OS_NAME= + fi fi cat <&2 + exit 1 + ;; +esac + +steps=() +steps+=(test-sanity) +steps+=(shellcheck) +steps+=(test-checks) +steps+=(test-coverage) +steps+=(test-stable) +steps+=(test-stable-perf) +steps+=(test-downstream-builds) +steps+=(test-bench) +steps+=(test-local-cluster) + +step_index=0 +if [[ -n "$1" ]]; then + start_step="$1" + while [[ $step_index -lt ${#steps[@]} ]]; do + step="${steps[$step_index]}" + if [[ "$step" = "$start_step" ]]; then + break + fi + step_index=$((step_index + 1)) + done + if [[ $step_index -eq ${#steps[@]} ]]; then + echo "unexpected start step: \"$start_step\"" 1>&2 + exit 1 + else + echo "** starting at step: \"$start_step\" **" + echo + fi +fi + +while [[ $step_index -lt ${#steps[@]} ]]; do + step="${steps[$step_index]}" + cmd="ci/${step}.sh" + $cmd + step_index=$((step_index + 1)) +done