Skip to content

CI: validate the Vagrantfile on every change - #1382

Merged
gusthoff merged 4 commits into
AdaCore:mainfrom
gusthoff:dev/topic/infrastructure/ci/vagrantfile-validation/2026-09-18
Sep 18, 2026
Merged

gusthoff merged 4 commits into
AdaCore:mainfrom
gusthoff:dev/topic/infrastructure/ci/vagrantfile-validation/2026-09-18

Conversation

@gusthoff

Copy link
Copy Markdown
Collaborator

The Vagrantfile had no automated check, so a Ruby or environment-handling mistake only surfaced when someone ran vagrant up.

Check the Ruby syntax, load the configuration under each accepted combination of LEARN_VM_HOST_IO_CACHE and LEARN_VM_STORAGE_CONTROLLER, and assert that an unrecognized cache value is refused. Without that negative case, deleting the guard would leave the workflow green.

No provider is installed on the runner, so --ignore-provider is used and the scope is the Vagrantfile itself rather than VirtualBox: a wrong storage controller name still passes and needs a real boot to catch.

Runs only on changes to Vagrantfile or to the workflow.

The Vagrantfile had no automated check, so a Ruby or environment-handling
mistake only surfaced when someone ran `vagrant up`.

Check the Ruby syntax, load the configuration under each accepted
combination of `LEARN_VM_HOST_IO_CACHE` and `LEARN_VM_STORAGE_CONTROLLER`,
and assert that an unrecognized cache value is refused. Without that
negative case, deleting the guard would leave the workflow green.

No provider is installed on the runner, so `--ignore-provider` is used and
the scope is the Vagrantfile itself rather than VirtualBox: a wrong storage
controller name still passes and needs a real boot to catch.

Runs only on changes to `Vagrantfile` or to the workflow.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
gusthoff and others added 3 commits September 18, 2026 18:09
Ubuntu's archive carries no `vagrant` package, so the workflow failed at
`apt-get install -y vagrant` with "Package 'vagrant' has no installation
candidate" before reaching any validation.

Fetch the release from HashiCorp and pin the version, the way the box
version is pinned, rather than depending on the distribution archive or on
HashiCorp publishing an apt suite for each Ubuntu codename.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The negative case accepted any non-zero exit from `vagrant validate`, so
it would have passed even with the guard deleted: validation can fail for
unrelated reasons and the test could not tell the difference.

Capture the output and require the Vagrantfile's own message, reporting
the unexpected output when something else fails.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Installing Vagrant costs an 87 MB download, which is disproportionate on
every push to a branch: changes to the `Vagrantfile` arrive in bursts, so
an active month ran it around twenty times.

Split the workflow into a `syntax` job, which only parses and needs
nothing beyond the Ruby already on the runner, and a `validate` job
carrying the download. The syntax check still runs on every push and
reports within seconds; validation runs on pull requests, so broken
configuration cannot reach `main` either way.

`validate` also depends on `syntax`, so a file that does not parse never
triggers the download.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gusthoff
gusthoff merged commit fa89f07 into AdaCore:main Sep 18, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant