Repository navigation
ci: Speed up the smoke test - #1468
Closed
marcleblanc2 wants to merge 7 commits into
Closed
marcleblanc2 wants to merge 7 commits into
marcleblanc2 wants to merge 7 commits into
Conversation
Skip waiting on the VM deletion, poll container health instead of sleeping 90 seconds, pull images in parallel, install fewer Vagrant plugins, and skip the smoke test on docs-only builds. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c731-7931-7091-9b5e-664cc2379c79 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1c731-7931-7091-9b5e-664cc2379c79 Co-authored-by: Amp <amp@ampcode.com>
Measured on build 16813: image pulls took 90s, against 93s on pd-standard in build 16811, so the disk is not what limits them. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c731-7931-7091-9b5e-664cc2379c79 Co-authored-by: Amp <amp@ampcode.com>
if_changed compares a build against origin/main. For a commit which is already on main, and is not the newest, that comparison is empty, so the smoke test was skipped. Only apply if_changed on other branches. The health check wait is shorter than the sleep it replaced, so a crash-looping container was more likely to be seen as running. Fail the test if any container has restarted. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c731-7931-7091-9b5e-664cc2379c79 Co-authored-by: Amp <amp@ampcode.com>
The Buildkite pipeline's default branch is still "master", so pipeline.default_branch never matched a build on main. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c731-7931-7091-9b5e-664cc2379c79 Co-authored-by: Amp <amp@ampcode.com>
1 task done
1 task done
…ale VMs A build cancelled while GCP was still creating the VM leaked it, because Vagrant only records the VM once the creation has finished, so the cleanup found nothing to delete. The VM now carries its Buildkite job ID as a label, and the cleanup deletes by that label. As a backstop for jobs which die before their cleanup runs, every job deletes labelled VMs older than an hour. The step times out after 30 minutes, so no running job owns a VM that old. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c731-7931-7091-9b5e-664cc2379c79 Co-authored-by: Amp <amp@ampcode.com>
Vagrant creates the boot disk before the VM, and the disk carries no labels. A build cancelled between the two left the disk behind, and the label lookup from the previous commit could not find it. sourcegraph-ci holds three such disks, from September. The VM and its disk are now named docker-test-job-<Buildkite job ID>. The cleanup and the stale sweep delete VMs by that name, and disks by that name which no VM uses. This replaces the label. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c731-7931-7091-9b5e-664cc2379c79 Co-authored-by: Amp <amp@ampcode.com>
This was referenced Nov 10, 2026
Contributor
Author
|
Closing in favor of smaller PRs in the stack at https://github.com/sourcegraph/deploy-sourcegraph-docker/stack/1491: #1484 skips the smoke test on branches which only change Markdown files, and #1487 pulls images in parallel and waits for health checks instead of sleeping. The Vagrant speed-ups here are not needed, because #1488 removes Vagrant. The branch stays. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
:rice: docker-compose-testjob took 7.5 to 10 minutes on every PR. Most of that was waiting, not testing. This PR removes the waits we control from this repo.The job took 228s to 353s on this PR's five builds (16811, 16813, 16814, 16816, 16822), against 458s to 594s on the 14 passing builds before it (16794-16810).
vagrant-googleonly if it's missing (agents on a host share~/.vagrant.d). Dropvagrant-env: there is notest/.envto load. Installvagrant-scponly when the test fails and we need the logs.docker-compose pullbeforeup. Compose v1uppulls one image at a time;pullruns in parallel.sleep 90: poll every 5s until/healthzresponds and no container health check isstartingorunhealthy. Fails after 5 minutes.vagrant destroyif the request fails.Also:
*.mdfiles (if_changed). The compose validation and prettier steps still run. Builds onmainalways run the smoke test.docker-compose versionin the smoke test log. The e2e image ships Compose 1.29.2.Leaked VMs and disks
sourcegraph-ciholds three old test VMs and three unattached test disks. Vagrant creates the boot disk, then the VM, and only records the VM once GCP has finished creating it, about 20s later. A build cancelled inside that window ranvagrant destroy, which replied "Instance is not created", and deleted nothing. Build 16663 leakeddocker-test-179202280492015this way on 2026-10-15, a 16 vCPU VM which is still running.docker-test-job-<Buildkite job ID>, so the cleanup deletes them by name, without asking Vagrant. It deletes the VM, or the disk if no VM uses it.docker-test-job-*VMs, and unattached disks, older than an hour. The smoke test step now times out after 30 minutes, so nothing that old belongs to a running job.maxRunDurationwithinstanceTerminationAction: DELETE), but only if it is set when the VM is created, andvagrant-google2.7.0 can't set it. Creating the VM withgcloud compute instances create --max-run-durationinstead of Vagrant would replace the sweep.Things to know
unhealthynow fails the test. It is also shorter, so the test looks at the containers about a minute sooner. To make up for that, the test now fails if any container has restarted, which catches a crash-loop however quickly we look. A container without a health check, which first crashes more than about 30s after starting, would have been caught by the 90s sleep, and is not caught now.main(always runs), once for other branches (if_changed). Each build shows the one which doesn't apply as a greyed-out job.if_changedcompares againstorigin/main, so onmainit would find no changes in any commit but the newest, and skip the test.masteras the default branch. Builds without a pull request therefore can't work out a diff, and run every step. So the docs-only skip only applies once the pull request is open. Fixing the setting makes the skip work on the first push too.config.env.enablemeans a localvagrant upno longer readstest/.env. Nothing documented that file; the deletedTESTING.mdtold developers to export the variables.pd-balancedboot disk. It didn't speed up the pulls (89s, against 93s onpd-standard).Checklist
Test plan
.buildkite/vagrant-run.shlocally against stubbedvagrant,gcloud, andcurl, covering: nothing to delete, a VM, an unattached disk (each sends the delete requests, and skipsvagrant destroy), and a failing instance list, disk list, or delete request (each falls back tovagrant destroy)vagrant destroy. Build 16829 is the first with the job-named VMgcloud compute operations list --project=sourcegraph-cishows a completeddeletefor every VM these builds created, including the VM of a build which was cancelled while it waited for SSH (16820)VAGRANT_HOME, and passednode-exporter. The job failed with exit status 1, installedvagrant-scp, copiednode-exporter.logfrom the VM, uploaded it as an artifact, and deleted the VM.mdfile) skipped the smoke test, and passed in 15s. Build 16820, the same branch before Buildkite knew about the pull request, ran itmain, simulated: build 16844 (TEMPORARY: CI test for #1468, do not merge #1476, a throwaway pull request) ran this branch withmainreplaced by the throwaway branch's name in bothifconditions, and changed one.mdfile.if_changedfound the one changed file. The always-run step still ran the smoke test, and passed; the branch step was skipped. Build 16821 skipped the smoke test for the same kind of changemainbranch. That needs a merge, or a Buildkite token which can create builds