[CI] Harden Defend Workflows VM provisioning#254354
[CI] Harden Defend Workflows VM provisioning#254354patrykkopycinski merged 3 commits intoelastic:mainfrom
Conversation
- Bump diskSizeGb from 105 to 120 across all DW pipeline configs - Add pre-flight disk space check before vagrant up (fail fast <10GB) - Add vagrant up retry logic (2 attempts) with cleanup between retries - Replace apt-get install unzip with python3 zipfile wrapper (no network) - Harden Vagrantfile: mkdir -p, capture stdout/stderr for diagnostics
|
/ci |
|
/ci |
1 similar comment
|
/ci |
dfe64ce to
bc41042
Compare
|
/ci |
bc41042 to
2fbd209
Compare
|
/ci |
- Add ensure_virtualbox.sh: checks, recovers, or installs VirtualBox - Source ensure_virtualbox.sh in all 4 DW shell scripts - Set VAGRANT_DEFAULT_PROVIDER=virtualbox on CI - Add ensureVirtualBoxProvider() in vm_services.ts as defense-in-depth - Pre-flight disk space check before vagrant up - Vagrant up retry logic (2 attempts) with cleanup between retries - Replace apt-get install unzip with python3 zipfile wrapper (no network) - Proper TypeScript error type casts
|
/ci |
eced2de to
00a9766
Compare
|
/ci |
00a9766 to
a338326
Compare
|
/ci |
- Add ensure_virtualbox.sh: checks, recovers, or installs VirtualBox - Default VAGRANT_DEFAULT_PROVIDER=virtualbox on CI to skip auto-discovery - Add ensureVirtualBoxProvider() in vm_services.ts as defense-in-depth - Keep local runs unchanged (VMware auto-discovery preserved)
|
/ci |
a338326 to
83a1856
Compare
- Improved ensure_virtualbox.sh: kernel module check, VBox 7.1 upgrade path, DKMS diagnostics - Vagrantfile: use simple apt-get install unzip (matching PR) - vm_services.ts: refined ensureVirtualBoxProvider with proper kernel module detection and VBox 7.1 upgrade fallback
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
|
| } | ||
|
|
||
| _upgrade_to_vbox71() { | ||
| echo "Upgrading to VirtualBox 7.1 (supports newer kernels)..." |
There was a problem hiding this comment.
is it better to make sure CI images ship with Virtual Box 7.1? Should we add a TODO / open a ticket for it?
There was a problem hiding this comment.
definitely having it on CI images is a better longterm solution, but I think it would make sense to keep it here as well, so we have a better logs if it starts failing again in the future
ashokaditya
left a comment
There was a problem hiding this comment.
Thanks for the changes!! I've a few suggestions but otherwise LGTM. 🚢 it!
| return; | ||
| } | ||
|
|
||
| const loadModules = async (): Promise<boolean> => { |
There was a problem hiding this comment.
consider renaming this to isVirtualBoxLoaded or areModulesLoaded
| log?: ToolingLog; | ||
| } | ||
|
|
||
| const ensureVirtualBoxProvider = async (log: ToolingLog): Promise<void> => { |
There was a problem hiding this comment.
Consider moving CreateVagrantVmOptions type close to thecreateVagrantHostVmClient function below.
| if (await upgradeToVbox71()) { | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
Should we log here that upgrade was successful?
|
Starting backport for target branches: 8.19, 9.2, 9.3 https://github.com/elastic/kibana/actions/runs/22300406621 |
- Rename loadModules to tryLoadModules for clarity - Move CreateVagrantVmOptions interface next to createVagrantVm - Log success message after VirtualBox 7.1 upgrade
## Summary Fixes Defend Workflows Cypress CI failures caused by VirtualBox kernel module not being loaded on CI agents. The CI image ships with VirtualBox 7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module compilation for that version. ### Changes **New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by all Defend Workflows CI scripts. It: 1. Checks if `VBoxManage --version` reports a healthy state (not just exit code — parses output for "kernel module is not loaded" warning) 2. Attempts to load existing kernel modules (`modprobe vboxdrv`, `/sbin/vboxconfig`) 3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades to **VirtualBox 7.1** from Oracle's repo which supports newer kernels 4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's provider auto-discovery 5. Prints full diagnostics on failure (packages, kernel version, DKMS status) **Updated: `vm_services.ts`** - `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local dev keeps VMware auto-discovery) - Pre-flight disk space check **Updated: `Vagrantfile`** - Installs `unzip` via `apt-get` for provisioning ### Files changed - `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new) - `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files — source ensure_virtualbox.sh) - `x-pack/.../endpoint/common/vm_services.ts` - `x-pack/.../endpoint/common/vagrant/Vagrantfile` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 11333fb)
## Summary Fixes Defend Workflows Cypress CI failures caused by VirtualBox kernel module not being loaded on CI agents. The CI image ships with VirtualBox 7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module compilation for that version. ### Changes **New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by all Defend Workflows CI scripts. It: 1. Checks if `VBoxManage --version` reports a healthy state (not just exit code — parses output for "kernel module is not loaded" warning) 2. Attempts to load existing kernel modules (`modprobe vboxdrv`, `/sbin/vboxconfig`) 3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades to **VirtualBox 7.1** from Oracle's repo which supports newer kernels 4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's provider auto-discovery 5. Prints full diagnostics on failure (packages, kernel version, DKMS status) **Updated: `vm_services.ts`** - `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local dev keeps VMware auto-discovery) - Pre-flight disk space check **Updated: `Vagrantfile`** - Installs `unzip` via `apt-get` for provisioning ### Files changed - `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new) - `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files — source ensure_virtualbox.sh) - `x-pack/.../endpoint/common/vm_services.ts` - `x-pack/.../endpoint/common/vagrant/Vagrantfile` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 11333fb)
## Summary Fixes Defend Workflows Cypress CI failures caused by VirtualBox kernel module not being loaded on CI agents. The CI image ships with VirtualBox 7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module compilation for that version. ### Changes **New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by all Defend Workflows CI scripts. It: 1. Checks if `VBoxManage --version` reports a healthy state (not just exit code — parses output for "kernel module is not loaded" warning) 2. Attempts to load existing kernel modules (`modprobe vboxdrv`, `/sbin/vboxconfig`) 3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades to **VirtualBox 7.1** from Oracle's repo which supports newer kernels 4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's provider auto-discovery 5. Prints full diagnostics on failure (packages, kernel version, DKMS status) **Updated: `vm_services.ts`** - `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local dev keeps VMware auto-discovery) - Pre-flight disk space check **Updated: `Vagrantfile`** - Installs `unzip` via `apt-get` for provisioning ### Files changed - `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new) - `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files — source ensure_virtualbox.sh) - `x-pack/.../endpoint/common/vm_services.ts` - `x-pack/.../endpoint/common/vagrant/Vagrantfile` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 11333fb)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `9.3`: - [[CI] Harden Defend Workflows VM provisioning (#254354)](#254354) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Patryk Kopyciński","email":"contact@patrykkopycinski.com"},"sourceCommit":{"committedDate":"2026-02-23T09:36:04Z","message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","ci:all-cypress-suites","backport:all-open","v9.4.0"],"title":"[CI] Harden Defend Workflows VM provisioning","number":254354,"url":"https://github.com/elastic/kibana/pull/254354","mergeCommit":{"message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/254354","number":254354,"mergeCommit":{"message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee"}}]}] BACKPORT--> Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
# Backport This will backport the following commits from `main` to `9.2`: - [[CI] Harden Defend Workflows VM provisioning (#254354)](#254354) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Patryk Kopyciński","email":"contact@patrykkopycinski.com"},"sourceCommit":{"committedDate":"2026-02-23T09:36:04Z","message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","ci:all-cypress-suites","backport:all-open","v9.4.0"],"title":"[CI] Harden Defend Workflows VM provisioning","number":254354,"url":"https://github.com/elastic/kibana/pull/254354","mergeCommit":{"message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/254354","number":254354,"mergeCommit":{"message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee"}}]}] BACKPORT--> Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
# Backport This will backport the following commits from `main` to `8.19`: - [[CI] Harden Defend Workflows VM provisioning (#254354)](#254354) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Patryk Kopyciński","email":"contact@patrykkopycinski.com"},"sourceCommit":{"committedDate":"2026-02-23T09:36:04Z","message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","ci:all-cypress-suites","backport:all-open","v9.4.0"],"title":"[CI] Harden Defend Workflows VM provisioning","number":254354,"url":"https://github.com/elastic/kibana/pull/254354","mergeCommit":{"message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/254354","number":254354,"mergeCommit":{"message":"[CI] Harden Defend Workflows VM provisioning (#254354)\n\n## Summary\n\nFixes Defend Workflows Cypress CI failures caused by VirtualBox kernel\nmodule not being loaded on CI agents. The CI image ships with VirtualBox\n7.0.x, but recent GCP kernel updates (`6.17.0-1008-gcp`) break module\ncompilation for that version.\n\n### Changes\n\n**New: `ensure_virtualbox.sh`** — shared pre-flight script sourced by\nall Defend Workflows CI scripts. It:\n1. Checks if `VBoxManage --version` reports a healthy state (not just\nexit code — parses output for \"kernel module is not loaded\" warning)\n2. Attempts to load existing kernel modules (`modprobe vboxdrv`,\n`/sbin/vboxconfig`)\n3. If module build fails (kernel too new for VirtualBox 7.0.x), upgrades\nto **VirtualBox 7.1** from Oracle's repo which supports newer kernels\n4. Exports `VAGRANT_DEFAULT_PROVIDER=virtualbox` to skip Vagrant's\nprovider auto-discovery\n5. Prints full diagnostics on failure (packages, kernel version, DKMS\nstatus)\n\n**Updated: `vm_services.ts`**\n- `VAGRANT_DEFAULT_PROVIDER=virtualbox` set in vagrant env on CI (local\ndev keeps VMware auto-discovery)\n- Pre-flight disk space check\n\n**Updated: `Vagrantfile`**\n- Installs `unzip` via `apt-get` for provisioning\n\n### Files changed\n- `.buildkite/scripts/steps/functional/ensure_virtualbox.sh` (new)\n- `.buildkite/scripts/steps/functional/defend_workflows*.sh` (4 files —\nsource ensure_virtualbox.sh)\n- `x-pack/.../endpoint/common/vm_services.ts`\n- `x-pack/.../endpoint/common/vagrant/Vagrantfile`\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"11333fb52d6523a888326c1f2987e0f6ced060ee"}}]}] BACKPORT--> Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
…4354) Cherry-pick from patrykkopycinski/kibana#254354 (83a1856): - Add ensure_virtualbox.sh for VirtualBox kernel module recovery - Source ensure_virtualbox.sh in all 4 DW shell scripts - Set VAGRANT_DEFAULT_PROVIDER=virtualbox on CI - Add ensureVirtualBoxProvider() in vm_services.ts - Vagrant up retry logic with cleanup between attempts - Combine apt-get update+install in Vagrantfile
Summary
Fixes Defend Workflows Cypress CI failures caused by VirtualBox kernel module not being loaded on CI agents. The CI image ships with VirtualBox 7.0.x, but recent GCP kernel updates (
6.17.0-1008-gcp) break module compilation for that version.Changes
New:
ensure_virtualbox.sh— shared pre-flight script sourced by all Defend Workflows CI scripts. It:VBoxManage --versionreports a healthy state (not just exit code — parses output for "kernel module is not loaded" warning)modprobe vboxdrv,/sbin/vboxconfig)VAGRANT_DEFAULT_PROVIDER=virtualboxto skip Vagrant's provider auto-discoveryUpdated:
vm_services.tsVAGRANT_DEFAULT_PROVIDER=virtualboxset in vagrant env on CI (local dev keeps VMware auto-discovery)Updated:
Vagrantfileunzipviaapt-getfor provisioningFiles changed
.buildkite/scripts/steps/functional/ensure_virtualbox.sh(new).buildkite/scripts/steps/functional/defend_workflows*.sh(4 files — source ensure_virtualbox.sh)x-pack/.../endpoint/common/vm_services.tsx-pack/.../endpoint/common/vagrant/Vagrantfile