From 02b9720bc6f4f0b3d57faf09f2475ec4617a19d5 Mon Sep 17 00:00:00 2001 From: yihau Date: Tue, 27 Jun 2023 16:34:35 +0800 Subject: [PATCH 1/4] ci: only kill containers that are based on the solanalabs/rust* images --- .buildkite/hooks/post-checkout | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.buildkite/hooks/post-checkout b/.buildkite/hooks/post-checkout index e4893c67dd4c8a..0804f46639a178 100644 --- a/.buildkite/hooks/post-checkout +++ b/.buildkite/hooks/post-checkout @@ -10,14 +10,18 @@ source ci/env.sh # previous CI job # ( - containers=$(docker ps -q) - if [[ $(hostname) != metrics-main && $(hostname) != metrics-internal && -n $containers ]]; then - echo "+++ Killing stale docker containers" - docker ps + echo "+++ Killing stale docker containers" + while read -r line; do + id="$(echo "$line" | awk '{print $1}')" + image="$(echo "$line" | awk '{print $2}')" - # shellcheck disable=SC2086 # Don't want to double quote $containers - docker kill $containers - fi + if [[ $image == *"solanalabs/rust"* ]]; then + if docker kill "$id" >/dev/null; then + echo "kill $id $image" + fi + continue + fi + done < <(docker ps | tail -n +2) ) # Processes from previously aborted CI jobs seem to loiter, unclear why as one From 81a365a2de87d750463bcbf8988b1abff2641b86 Mon Sep 17 00:00:00 2001 From: Yihau Chen Date: Wed, 28 Jun 2023 01:22:46 +0800 Subject: [PATCH 2/4] Update .buildkite/hooks/post-checkout Co-authored-by: Trent Nelson --- .buildkite/hooks/post-checkout | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.buildkite/hooks/post-checkout b/.buildkite/hooks/post-checkout index 0804f46639a178..c30d0bbc18e5b8 100644 --- a/.buildkite/hooks/post-checkout +++ b/.buildkite/hooks/post-checkout @@ -12,8 +12,7 @@ source ci/env.sh ( echo "+++ Killing stale docker containers" while read -r line; do - id="$(echo "$line" | awk '{print $1}')" - image="$(echo "$line" | awk '{print $2}')" + read id image _ <<<"$line" if [[ $image == *"solanalabs/rust"* ]]; then if docker kill "$id" >/dev/null; then From b9a73fdf63463a9f65d0b61b092418161b50ff59 Mon Sep 17 00:00:00 2001 From: Yihau Chen Date: Wed, 28 Jun 2023 01:22:54 +0800 Subject: [PATCH 3/4] Update .buildkite/hooks/post-checkout Co-authored-by: Trent Nelson --- .buildkite/hooks/post-checkout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/hooks/post-checkout b/.buildkite/hooks/post-checkout index c30d0bbc18e5b8..8a1599ef2ae075 100644 --- a/.buildkite/hooks/post-checkout +++ b/.buildkite/hooks/post-checkout @@ -14,7 +14,7 @@ source ci/env.sh while read -r line; do read id image _ <<<"$line" - if [[ $image == *"solanalabs/rust"* ]]; then + if [[ $image =~ "solanalabs/rust" ]]; then if docker kill "$id" >/dev/null; then echo "kill $id $image" fi From 82294edd63f69e2e3ad05bfebbbdfc86696b9ce6 Mon Sep 17 00:00:00 2001 From: yihau Date: Wed, 28 Jun 2023 01:24:28 +0800 Subject: [PATCH 4/4] fix lint --- .buildkite/hooks/post-checkout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/hooks/post-checkout b/.buildkite/hooks/post-checkout index 8a1599ef2ae075..a36d2574ebbfad 100644 --- a/.buildkite/hooks/post-checkout +++ b/.buildkite/hooks/post-checkout @@ -12,7 +12,7 @@ source ci/env.sh ( echo "+++ Killing stale docker containers" while read -r line; do - read id image _ <<<"$line" + read -r id image _ <<<"$line" if [[ $image =~ "solanalabs/rust" ]]; then if docker kill "$id" >/dev/null; then