如何将 Vagrant 与 Jenkins 结合起来,打造完美的持续集成环境?

发布于 2024-11-28 01:21:24 字数 495 浏览 3 评论 0原文

您有一个需要运行一些软件要求的项目(例如:特定版本的 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 技术交流群。

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

发布评论

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

评论(3

不可一世的女人 2024-12-05 01:21:24

这是构建系统的一个很好的解决方案,我的建议:

  1. 您当前的jenkins作为主CI(可能由用户jenkins启动)
  2. 在同一台机器或另一台机器上创建另一个用户以作为jenkins从属模式工作
    • jenkins Slave可以从jenkins master调用,并且可以使用像vagrant这样拥有vagrant权限和环境的不同用户,因此不会干扰原来的jenkins master服务器
    • 创建您的基础 vagrant box,然后可以重复使用它来加速您的部署
  3. 大多数安装信息(包)可以由 puppet(或 Chef)管理以加载到您的虚拟机框中。

也许你可以看看 veewee,它可以动态创建 vagrant box。

这是 使用 Jenkins CI 和 Vagrant 让 CI 变得更容易,这是我提出此建议的指南。

it is a good solution for build system, my suggestion:

  1. Your current jenkins works as master CI (probably started by user jenkins)
  2. Create another user in same machine or another machine to work as jenkins slave mode
    • jenkins slave can be invoked from jenkins master, and it can use different user like vagrant who had permission and environment for vagrant, therefore it will not interfere the original jenkins master server
    • create your base vagrant box, then it can be reused to speedup for your deployment
  3. Most of the installation information (packages) could be managed by puppet (or chef) to be loaded into your vm box.

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.

少女的英雄梦 2024-12-05 01:21:24

您可以尝试当前支持 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

又爬满兰若 2024-12-05 01:21:24

就我个人而言,我建议使用 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

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