如何在Travis-CI中使用Vagrant启动Virtualbox虚拟机?
我知道在虚拟机内部启动虚拟机有时不被支持,但是有关于这个特定配置的成功报告。
我正在尝试设置一个持续集成服务器来运行我的系统管理员工具的单元测试,以在不同的操作系统和Python版本上进行测试。它使用Tox来处理各种Python虚拟环境的初始化,并使用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虚拟机?