如何将 Vagrant 与 Jenkins 结合起来,打造完美的持续集成环境?
您有一个需要运行一些软件要求的项目(例如:特定版本的 Apache、PHP 版本、MySQL 数据库实例和其他几个软件)。
您已经发现了 Vagrant,因此您的虚拟环境已全部设置完毕。您可以根据配置文件和说明书创建盒子。
您还了解了 Jenkins 等持续集成系统的优势。
现在您希望将这两个世界(Vagrant 和 Jenkins)结合起来以获得完美的持续集成环境。更具体地说,您不想在运行 Jenkins 的机器上安装项目所需的软件,但您希望使用 Vagrant 提供的虚拟环境定期在其上构建您的项目。 CI 软件 (Jenkins) 将为您构建 Vagrant box,并在其上构建和测试您的项目。
您将如何设置环境来实现这一目标?
You have a project which has got some SW requirements to run (e.g.: a specific version of Apache, a version of PHP, an instance of a MySQL database and a couple of other pieces of software).
You have already discovered Vagrant, so your virtual environment is all setup. You can create boxes out of your configuration files and cookbooks.
You have also understood the advantages of a Continuous Integration system such as Jenkins.
Now you would like to combine these two worlds (Vagrant and Jenkins) to get the perfect Continuous Integration Environment. To be more specific, you would like not to install the SW required by your project on the machine running Jenkins, but you would like to use the virtual environment provided by Vagrant to periodically build your project on the top of it. The CI software (Jenkins) will build the Vagrant box for you and build and test your project on the top of it.
How would you setup your environment to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是构建系统的一个很好的解决方案,我的建议:
也许你可以看看 veewee,它可以动态创建 vagrant box。
这是 使用 Jenkins CI 和 Vagrant 让 CI 变得更容易,这是我提出此建议的指南。
it is a good solution for build system, my suggestion:
Probably you can take a look at veewee, which can create vagrant box on fly.
Here is the Make CI easier with Jenkins CI and Vagrant for my guideline for this suggestion.
您可以尝试当前支持 Jenkins CD 1.532 的 Vagrant Plugin for Jenkins。 3
您可以在 http://unethicalblogger.com/2012/03/13/vagrant-plugin-in-action.html
You could try the Vagrant Plugin for Jenkins that currently supports Jenkins CD 1.532.3
You can see a demo of this plugin running at http://unethicalblogger.com/2012/03/13/vagrant-plugin-in-action.html
就我个人而言,我建议使用 Hashicorp Packer 为开发人员构建 Vagrant 盒子,然后使用它来输出可以在 CI 系统上运行的 Docker 或 AWS 或 OpenStack 映像。 Vagrant 是一个很棒的工具,但是对于 CI 系统来说,不断地上下旋转虚拟机的开销可能有点高,特别是如果您想要真正快速的反馈的话。
在以前的客户中,我们基本上使用系统启动 Vagrant 机器一次,然后在这些虚拟机内运行 Docker/virtualenv 构建,并且当出现重大升级或环境行为不正确的问题时,我们会定期销毁它们。
https://www.packer.io/docs/builders/openstack.html
Personally I'd suggest using Hashicorp Packer to build out your Vagrant boxes for developers, and then use it to also output a Docker or AWS or OpenStack image that you can run on your CI system. Vagrant is an awesome tool, but the overhead of VMs can be a little high for a CI system to constantly spin them up and down, especially if you want really fast feedback.
At a former client we basically booted the Vagrant machines once with the system, and then ran Docker/virtualenv builds inside of those VMs and we periodically destroyed them when there was a major upgrade or an issue with the environment not behaving correctly.
https://www.packer.io/docs/builders/openstack.html