我在jenkins上使用VirtualBox插件,启动从Git检索源代码的不同版本。我希望通过在启动快照之前恢复快照来清理每个VM上的环境。
我尝试了几件https://wiki.jenkins-ci.org/display/JENKINS/Slave+Setup+Plugin。 最后,我不认为这是一个很好的解决方案,因为它是在git存储库被克隆之后调用的......但我也尝试通过在master上执行命令来启动slave"# 34;,它将vm的名称作为参数并调用此脚本:
VBoxManage registervm "C:\Users\mfauvet\VirtualBox VMs\%1\%1.vbox
VBoxManage controlvm %1 poweroff
VBoxManage snapshot %1 restore SetEnvironment
VBoxManage startvm %1
ssh 192.168.120.1 -p 1310
但我有以下错误:
C:\Program Files (x86)\Jenkins>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" registervm "C:\Users\mfauvet\VirtualBox VMs\Jenkins-Ubuntu13.10\Jenkins-Ubuntu13.10.vbox"
VBoxManage.exe: error: Trying to open a VM config 'C:\Users\mfauvet\VirtualBox VMs\Jenkins-Ubuntu13.10\Jenkins-Ubuntu13.10.vbox' which has the same UUID as an existing virtual machine
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component Machine, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "OpenMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 88 of file VBoxManageMisc.cpp
C:\Program Files (x86)\Jenkins>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm Jenkins-Ubuntu13.10 poweroff
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
C:\Program Files (x86)\Jenkins>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot Jenkins-Ubuntu13.10 restore SetEnvironment
0%...10%...20%...30%...40%...50%...
Progress object failure: RPC_S_SERVER_UNAVAILABLE 0x800706BA
Restoring snapshot 7f7cc1a3-7128-426a-bf74-9ffb0b3fbca8
C:\Program Files (x86)\Jenkins>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm Jenkins-Ubuntu13.10
VBoxManage.exe: error: Could not find a registered machine named 'Jenkins-Ubuntu13.10'
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 575 of file VBoxManageMisc.cpp
有人知道如何解决这个问题吗?或者有更好的方法在通过Jenkins启动它们之前恢复我的虚拟机上的快照? 感谢您的阅读
答案 0 :(得分:0)
我得到了这项工作,当然还有VMWare。
我采取的步骤
运行作业时,swarm slave作业将等待VM启动,然后再向其提交作业