From ed6af1b8703dbdb5733f74ab4500b26fdc5961cd Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 12 Jun 2023 11:36:08 +0800 Subject: [PATCH 1/8] Turn on command execution in Chromium indexing script --- .buildkite/chromium.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/chromium.sh b/.buildkite/chromium.sh index 3b742a53..58113ea3 100644 --- a/.buildkite/chromium.sh +++ b/.buildkite/chromium.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash +set -eux ZONE="us-central-1" PROJECT="sourcegraph-ci" INSTANCE="scip-clang-runner" # From https://stackoverflow.com/a/65683139/2682729 -function wait_vm() { +function wait_vm_start() { local counter=0 local maxRetry=20 while true ; do From 7d90b4ba39885ba90b48b69c5f251db57e8309a8 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 12 Jun 2023 11:41:51 +0800 Subject: [PATCH 2/8] Turn on Slack notifications for Chromium indexing --- .buildkite/chromium.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.buildkite/chromium.yaml b/.buildkite/chromium.yaml index b3cedcbb..ed092548 100644 --- a/.buildkite/chromium.yaml +++ b/.buildkite/chromium.yaml @@ -5,3 +5,5 @@ steps: queue: bazel command: | ./.buildkite/chromium.sh +notify: + - slack: "#code-intel-indexing-alerts" From 9bf953bcb42c0a9871ebc341c96a8302ba990ac1 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 12 Jun 2023 11:44:37 +0800 Subject: [PATCH 3/8] Fix GCloud zone --- .buildkite/chromium.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/chromium.sh b/.buildkite/chromium.sh index 58113ea3..9ae89742 100644 --- a/.buildkite/chromium.sh +++ b/.buildkite/chromium.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eux -ZONE="us-central-1" +ZONE="us-central1-c" PROJECT="sourcegraph-ci" INSTANCE="scip-clang-runner" From 21a2067e17f43b21b6542107d836e47b6b2ee1ee Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 12 Jun 2023 11:58:28 +0800 Subject: [PATCH 4/8] Fix label in Buildkite --- .buildkite/chromium.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/chromium.yaml b/.buildkite/chromium.yaml index ed092548..08110cd7 100644 --- a/.buildkite/chromium.yaml +++ b/.buildkite/chromium.yaml @@ -1,6 +1,6 @@ $schema: "http://json.schemastore.org/buildkite" steps: - - label: "Start VM" + - label: "Index Chromium" agents: queue: bazel command: | From 0d287c5fe8b88c057ced4773d25549b28894a279 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 12 Jun 2023 12:56:22 +0800 Subject: [PATCH 5/8] Mark file as executable to use bash interpreter --- .buildkite/chromium.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .buildkite/chromium.sh diff --git a/.buildkite/chromium.sh b/.buildkite/chromium.sh old mode 100644 new mode 100755 From 1494e13ce58bfc651cc43554c2ae168e1fba4ce6 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 12 Jun 2023 13:05:19 +0800 Subject: [PATCH 6/8] Debug if ++ is causing problem --- .buildkite/chromium.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/chromium.sh b/.buildkite/chromium.sh index 9ae89742..ea5f775b 100755 --- a/.buildkite/chromium.sh +++ b/.buildkite/chromium.sh @@ -9,6 +9,7 @@ INSTANCE="scip-clang-runner" function wait_vm_start() { local counter=0 local maxRetry=20 + ((counter++)) while true ; do if (( counter == maxRetry )) ; then echo "Reach the retry upper limit $counter" From 4370b4de788d7925566062727578019fdcdaf4ee Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 12 Jun 2023 13:27:42 +0800 Subject: [PATCH 7/8] Replace post-increment with pre-increment --- .buildkite/chromium.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/chromium.sh b/.buildkite/chromium.sh index ea5f775b..6ce7d7f0 100755 --- a/.buildkite/chromium.sh +++ b/.buildkite/chromium.sh @@ -9,7 +9,6 @@ INSTANCE="scip-clang-runner" function wait_vm_start() { local counter=0 local maxRetry=20 - ((counter++)) while true ; do if (( counter == maxRetry )) ; then echo "Reach the retry upper limit $counter" @@ -21,7 +20,8 @@ function wait_vm_start() { exit 0 else echo "Maybe later? Retry: $counter/$maxRetry" - ((counter++)) + # Don't use post-increment: https://stackoverflow.com/a/22428973/2682729 + ((++counter)) sleep 5 fi done From fc36042039e43e6145dd2af3bdb3eaf49662b5f8 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 12 Jun 2023 13:33:42 +0800 Subject: [PATCH 8/8] Reduce retry count and show stderr --- .buildkite/chromium.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/chromium.sh b/.buildkite/chromium.sh index 6ce7d7f0..734f396b 100755 --- a/.buildkite/chromium.sh +++ b/.buildkite/chromium.sh @@ -8,14 +8,14 @@ INSTANCE="scip-clang-runner" # From https://stackoverflow.com/a/65683139/2682729 function wait_vm_start() { local counter=0 - local maxRetry=20 + local maxRetry=10 while true ; do if (( counter == maxRetry )) ; then echo "Reach the retry upper limit $counter" exit 1 fi - if gcloud compute ssh --quiet --zone "$ZONE" --project "$PROJECT" "$INSTANCE" --tunnel-through-iap --command="true" 2> /dev/null ; then + if gcloud compute ssh --quiet --zone "$ZONE" --project "$PROJECT" "$INSTANCE" --tunnel-through-iap --command="true" ; then echo "The machine is up!" exit 0 else