Skip to content

Autodetect VirtualBox path on Windows

Pedro Pombeiro requested to merge mr-origin-168 into master

What does this MR do?

It looks through the different Program Files paths on Windows in order to find an installation of VirtualBox. If found, it adds it to the process PATH environment variable.

Why was this MR needed?

To remove the Windows-specific manual step of needing to add the VirtualBox installation path to the PATH environment variable.

Are there points in the code the reviewer needs to double check?

NOTE: Tested on Windows machine before and after installing VirtualBox, while Runner was running.

Steps are in issue description.

Tested the branch executable on Windows machine without VirtualBox installed (job link)

Running with gitlab-runner development version (HEAD)
  on Pedros-ThinkPad-X1C6-VirtualBox 6iAkNnsV
Resolving secrets
00:00
Preparing the "virtualbox" executor
00:09
ERROR: Preparation failed: exec: "vboxmanage": executable file not found in %PATH%
Will be retried in 3s ...
ERROR: Preparation failed: exec: "vboxmanage": executable file not found in %PATH%
Will be retried in 3s ...
ERROR: Preparation failed: exec: "vboxmanage": executable file not found in %PATH%
Will be retried in 3s ...
ERROR: Job failed (system failure): exec: "vboxmanage": executable file not found in %PATH%

Tested the branch executable on Windows machine with VirtualBox installed (job link)

Running with gitlab-runner development version (HEAD)
  on Pedros-ThinkPad-X1C6-VirtualBox 6iAkNnsV
Resolving secrets
00:00
Preparing the "virtualbox" executor
00:13
Using VirtualBox version 6.1.16r140961 executor...
Creating new VM...
WARNING: Failed to create snapshot Base State from base VM windows
ERROR: Preparation failed: VBoxManageOutput error: vboxmanage.exe: error: Could not find a registered machine named 'windows'
vboxmanage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
vboxmanage.exe: error: Context: "FindMachine(Bstr(pszSrcName).raw(), srcMachine.asOutParam())" at line 560 of file VBoxManageMisc.cpp
Will be retried in 3s ...

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Fixes #27305 (closed) !168 (closed)

Edited by Georgi N. Georgiev

Merge request reports

Loading