创建虚拟机映像作为持续集成工件?

发布于 2024-07-07 07:56:47 字数 225 浏览 7 评论 0原文

我目前正在开发一个服务器端产品,该产品在新服务器上部署有点复杂,这使其成为在虚拟机中进行测试的理想选择。 我们已经使用 Hudson 作为我们的 CI 系统,我真的很希望能够使用最新、最好的软件来部署虚拟机映像作为构建工件。

那么,具体该如何做呢? 建议使用什么 VM 软件来实现此目的? 需要编写多少脚本才能完成此任务? 使用Windows 2003 Server作为操作系统时有什么特别的问题吗?

I'm currently working on a server-side product which is a bit complex to deploy on a new server, which makes it an ideal candidate for testing out in a VM. We are already using Hudson as our CI system, and I would really like to be able to deploy a virtual machine image with the latest and greatest software as a build artifact.

So, how does one go about doing this exactly? What VM software is recommended for this purpose? How much scripting needs to be done to accomplish this? Are there any issues in particular when using Windows 2003 Server as the OS here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

花开浅夏 2024-07-14 07:56:47

很抱歉在这里拒绝任何人接受的答案,但根据进一步的研究(感谢您的回答!),我找到了更好的解决方案,并想总结我所发现的内容。

首先,VirtualBox 和 VMWare Server 都是很棒的产品,而且由于都是免费的,因此都值得评估。 我们决定使用 VMWare Server,因为它是一个更成熟的产品,并且我们可以在需要时获得对它的支持。 这一点尤其重要,因为我们还考虑将我们的软件作为虚拟机而不是特殊的服务器安装分发给客户端,假设 VMWare Player 的开销不太高。 另外,还有一个名为 VIX 的 VMWare 脚本接口,可以直接使用它将文件安装到虚拟机上,无需安装 SSH 或 SFTP,这是一个很大的优势。

所以我们的解决方案基本上如下......首先我们创建一个带有操作系统的“普通”VM 映像,仅此而已,然后将其签入存储库。 然后,我们编写一个脚本作为安装程序,将 Hudson 创建的工件放在虚拟机上。 该脚本应该具有通过 SFTP 和 VIX 直接复制文件的接口。 这将使我们能够继续直接在目标计算机上或通过我们选择的虚拟机分发软件。 然后,生成的图像将被压缩并作为 CI 服务器的工件进行分发。

Sorry to deny anyone an accepted answer here, but based on further research (thanks to your answers!), I've found a better solution and wanted to summarize what I've found.

First, both VirtualBox and VMWare Server are great products, and since both are free, each is worth evaluating. We've decided to go with VMWare Server, since it is a more established product and we can get support for it should we need. This is especially important since we are also considering distributing our software to clients as a VM instead of a special server installation, assuming that the overhead from the VMWare Player is not too high. Also, there is a VMWare scripting interface called VIX which one can use to directly install files to the VM without needing to install SSH or SFTP, which is a big advantage.

So our solution is basically as follows... first we create a "vanilla" VM image with OS, nothing else, and check it into the repository. Then, we write a script which acts as our installer, putting the artifacts created by Hudson on the VM. This script should have interfaces to copy files directly, over SFTP, and through VIX. This will allow us to continue distributing software directly on the target machine, or through a VM of our choice. This resulting image is then compressed and distributed as an artifact of the CI server.

游魂 2024-07-14 07:56:47

无论 VM 软件如何(我也可以推荐 VirtualBox),我认为您正在查看以下场景:

  1. 构建完成
  2. CI 启动虚拟机(或者它始终在运行)
  3. CI 使用 scp/sftp 通过网络将构建上传到 VM
  4. CI 使用 ssh(如果在 VM 中运行的目标操作系统上可用)或其他远程命令执行工具来触发 VM 环境中的安装

Regardless of the VM software (I can recommend VirtualBox, too) I think you are looking at the following scenario:

  1. Build is done
  2. CI launches virtual machine (or it is always running)
  3. CI uses scp/sftp to upload build into VM over the network
  4. CI uses the ssh (if available on target OS running in VM) or other remote command execution facility to trigger installation in the VM environment
东风软 2024-07-14 07:56:47

VMWare Server 是免费且非常稳定的产品。 它还使您能够创建虚拟机切片的快照并在需要时回滚到虚拟机的先前版本。 它将在 Win 2003 上运行良好。

在为您的构建配置新的 VM 切片方面,您只需复制并粘贴包含 VMWare 文件的文件夹,更改新 VM 的 SID 和 IP,您就拥有了一台新机器。 需要 15 分钟,具体取决于 VM 切片的大小。 无需编写脚本。

VMWare Server is free and a very stable product. It also gives you the ability to create snapshots of the VM slice and rollback to previous version of your virtual machine when needed. It will run fine on Win 2003.

In terms of provisioning new VM slices for your builds, you can simply copy and past the folder that contains the VMWare files, change the SID and IP of the new VM and you have a new machine. Takes 15 minutes depending on the size of your VM slice. No scripting required.

国产ˉ祖宗 2024-07-14 07:56:47

如果您使用 VirtualBox,您将需要考虑无头运行它,因为它将在您的服务器上。 通常,VirtualBox 作为桌面应用程序运行,但可以从命令行启动虚拟机并通过 RDP 访问虚拟机。

VBoxManage startvm "Windows 2003 Server" -type vrdp

If you use VirtualBox, you'll want to look into running it headless, since it'll be on your server. Normally, VirtualBox runs as a desktop app, but it's possible to start VMs from the commandline and access the virtual machine over RDP.

VBoxManage startvm "Windows 2003 Server" -type vrdp
请爱~陌生人 2024-07-14 07:56:47

对于这个场景,我们使用 Jenkins + Vagrant + Chef。

因此,您可以执行以下过程:

  • 使用 vagrant 配置脚本(Chef 或 Puppet)对 VM 环境进行版本控制

  • 使用以下命令构建系统Jenkins/Hudson

  • 运行 Vagrant 脚本以从 CI 输出获取最后一个稳定版本

  • 保存虚拟机状态以供将来重复使用。

参考:

vagrantup.com

We are using Jenkins + Vagrant + Chef for this scenario.

So you can do the following process:

  • Version control your VM environment using vagrant provisioning scripts (Chef or Puppet)

  • Build your system using Jenkins/Hudson

  • Run your Vagrant script to fetch the last stable release from CI output

  • Save the VM state to reuse in future.

Reference:

vagrantup.com

短暂陪伴 2024-07-14 07:56:47

我推荐VirtualBox。 它是免费的,并且有一个定义良好的编程接口,尽管我个人还没有在自动构建情况下使用过它。

I'd recommend VirtualBox. It is free and has a well-defined programming interface, although I haven't personally used it in automated build situations.

凉城已无爱 2024-07-14 07:56:47

目前选择VMWare并不是一个糟糕的选择。

然而,
就像VMWare 支持VMWare 服务器一样,SUN 支持VirtualBOX。

Choosing VMWare is currently NOT a bad choice.

However,
Just like VMWare gives support for VMWare server, SUN gives support for VirtualBOX.

微凉 2024-07-14 07:56:47

您还可以使用 VMWare Studio 完成此任务,它也是免费的。
基本工作流程是这样的:
1. 创建描述虚拟机的 XML 文件
2. 使用studio创建shell。
3. 使用VMWare 服务器配置虚拟机。

You can also accomplish this task using VMWare Studio, which is also free.
The basic workflow is this:
1. Create an XML file that describes your virtual machine
2. Use studio to create the shell.
3. Use VMWare server to provision the virtual machine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文