Skip to content

ci: Retry the SSH connection to the smoke test VM - #1471

Closed
marcleblanc2 wants to merge 3 commits into
mainfrom
retry-smoke-test-on-unreachable-vm
Closed

marcleblanc2 wants to merge 3 commits into
mainfrom
retry-smoke-test-on-unreachable-vm

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

The smoke test in build 16777 (#1465) failed before it ran. The test VM booted and answered SSH, then stopped answering a few seconds later, while Vagrant was syncing the repo to it. Vagrant gave up after about 20 seconds, and the job failed as if the test had failed.

This PR retries the SSH connection to that same VM. It never creates a second VM.

  • When vagrant up fails, vagrant-run.sh checks whether the VM answers SSH (vagrant ssh with a 15 second connect timeout).
  • If it answers, the test itself failed, and nothing changes: the script copies the logs and exits with the test's status.
  • If it does not answer, the script tries again every 15 seconds, up to 10 times (about 5 minutes).
  • Once the VM answers, vagrant provision syncs the repo to it and runs the test. vagrant up cannot be resumed, and vagrant provision runs the same two steps which vagrant up did not get to.
  • If the VM never answers, the job fails as it does today.

Not covered:

  • A VM which never answers SSH at all. vagrant-google waits for the first connection without a timeout.
  • Why the VM dropped off the network, and whether it comes back. In build 16777 it was still unreachable after 160 seconds, when the job gave up. I could not look at the VM without access to the sourcegraph-ci project.

#1468 changes the same lines of vagrant-run.sh, so whichever PR merges second needs a small rebase.

Checklist

  • All images have a valid tag and SHA256 sum (no image changes)

Test plan

Ran .buildkite/vagrant-run.sh docker-test locally with stub vagrant, gcloud, and sleep commands on the PATH, and checked the exit status and the vagrant calls made. Every case calls vagrant up once and vagrant destroy once.

vagrant up SSH vagrant provision Exit status Logs copied
passes not checked not run 0 no
fails with 3 answers not run 3 yes
fails with 3 answers on retry 2 passes 0 no
fails with 3 answers on retry 1 fails with 5 5 yes
fails with 3 never answers, 10 retries not run 255, from the failed log copy, as today attempted

Read the Vagrant 2.4.1 and vagrant-google 2.7.0 source to confirm that a failed vagrant up keeps the VM, and that vagrant provision syncs the folder before it runs the provisioners.

Not tested against a real VM which stops answering. CI on this PR only covers the first row.

vagrant up fails if the test VM drops off the network after its first
SSH connection. That is not a test result, so check whether the VM still
answers SSH when vagrant up fails, and exit with a status which Buildkite
retries once, on a new VM.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1c753-39cc-72c6-b71a-0a24497aaf5a
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Review feedback: keep the retry in the script. When the test VM stops
answering SSH, destroy it and run the test once more on a new VM, in
the same job.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1c753-39cc-72c6-b71a-0a24497aaf5a
Co-authored-by: Amp <amp@ampcode.com>
Review feedback: the job must not create a second VM. Undo the retry of
the whole test, and retry only the SSH connection to the VM which
vagrant up created. Once it answers, vagrant provision syncs the repo
and runs the test on that VM.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1c753-39cc-72c6-b71a-0a24497aaf5a
Co-authored-by: Amp <amp@ampcode.com>
@marcleblanc2 marcleblanc2 changed the title ci: Retry the smoke test when its VM stops answering SSH ci: Retry the SSH connection to the smoke test VM Nov 10, 2026
@marcleblanc2

Copy link
Copy Markdown
Contributor Author

Closing in favor of #1488, which retries the SSH connection on the same VM from the gcloud script. The branch stays.

@marcleblanc2
marcleblanc2 deleted the retry-smoke-test-on-unreachable-vm branch November 11, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant