在 Travis 中启动 Vagrant 虚拟机-CI
Launching a Vagrant VM inside Travis-CI
如何在 Travis-CI 中使用 Vagrant 启动 Virtualbox VM?
我知道有时不支持在 VM 内启动 VM,但已经有 reported successes 使用此特定配置。
我正在尝试为我的 sysadmin tool, to test it across different operating systems and Python versions. It uses Tox to handle initializing the various Python virtual environments and Pytest 到 运行 测试设置一个持续集成服务器 运行 单元测试,并包装 Vagrant 以设置和拆卸 Virtualbox VM。它 运行 在我的 Ubuntu 14 本地主机上没问题,但在 Travis 中,Vagrant 尝试启动 Virtualbox VM 时超时:
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: functional_tests_default_1463515960654_71459
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
...
The job exceeded the maximum time limit for jobs, and has been terminated.
由于它没有提供任何详细信息,我不确定如何诊断问题。我尝试使用 export VAGRANT_LOG=DEBUG;
启用更多输出,但没有显示任何有用的信息并且超出了 Travis 的最大日志大小。我也尝试增加超时时间,并将内存分配到 1GB,但都没有帮助。
我注意到的唯一奇怪的事情是我无法解释的,这条消息来自 sudo apt-get -y install -q virtualbox-ose-dkms virtualbox --fix-missing
:
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.
然而,就在这之前,安装内核源的命令成功了:
sudo apt-get -y --force-yes install linux-headers-`uname -r`
如何在 Travis-CI 中启动 Vagrant/Virtualbox 虚拟机?
遗憾的是,Travis-CI 不支持此功能,并且在不久的将来也没有这样做的计划。检查以下票证:https://github.com/travis-ci/travis-ci/issues/6060
由于 Travis 运行 您在虚拟化容器 (OpenVZ) 中构建,您可以尝试使用 32 位 VM。这可以工作,但我还没有测试过。
From the end of 2019 it is possible to run Vagrant on TravisCI! All you have to do, is to switch to libvirt & KVM provider instead of virtualbox
on Travis - for a complete HowTo and this fully comprehensible example project on GitHub: https://github.com/jonashackt/vagrant-travisci-libvrt
见this TravisCI build for example:
如果您不想在本地使用 libvirt
提供程序,您可以简单地使用 generic
Vagrant Box images from Vagrant Cloud 之一,因为它们同时支持 virtualbox
(本地)和 libvirt
(在 TravisCI 上)。
如何在 Travis-CI 中使用 Vagrant 启动 Virtualbox VM?
我知道有时不支持在 VM 内启动 VM,但已经有 reported successes 使用此特定配置。
我正在尝试为我的 sysadmin tool, to test it across different operating systems and Python versions. It uses Tox to handle initializing the various Python virtual environments and Pytest 到 运行 测试设置一个持续集成服务器 运行 单元测试,并包装 Vagrant 以设置和拆卸 Virtualbox VM。它 运行 在我的 Ubuntu 14 本地主机上没问题,但在 Travis 中,Vagrant 尝试启动 Virtualbox VM 时超时:
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: functional_tests_default_1463515960654_71459
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
...
The job exceeded the maximum time limit for jobs, and has been terminated.
由于它没有提供任何详细信息,我不确定如何诊断问题。我尝试使用 export VAGRANT_LOG=DEBUG;
启用更多输出,但没有显示任何有用的信息并且超出了 Travis 的最大日志大小。我也尝试增加超时时间,并将内存分配到 1GB,但都没有帮助。
我注意到的唯一奇怪的事情是我无法解释的,这条消息来自 sudo apt-get -y install -q virtualbox-ose-dkms virtualbox --fix-missing
:
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.
然而,就在这之前,安装内核源的命令成功了:
sudo apt-get -y --force-yes install linux-headers-`uname -r`
如何在 Travis-CI 中启动 Vagrant/Virtualbox 虚拟机?
遗憾的是,Travis-CI 不支持此功能,并且在不久的将来也没有这样做的计划。检查以下票证:https://github.com/travis-ci/travis-ci/issues/6060
由于 Travis 运行 您在虚拟化容器 (OpenVZ) 中构建,您可以尝试使用 32 位 VM。这可以工作,但我还没有测试过。
From the end of 2019 it is possible to run Vagrant on TravisCI! All you have to do, is to switch to libvirt & KVM provider instead of virtualbox
on Travis -
见this TravisCI build for example:
如果您不想在本地使用 libvirt
提供程序,您可以简单地使用 generic
Vagrant Box images from Vagrant Cloud 之一,因为它们同时支持 virtualbox
(本地)和 libvirt
(在 TravisCI 上)。