How to combine Vagrant with Jenkins for the perfect Continuous Integration Environment?

前端 未结 3 1588
心在旅途
心在旅途 2021-01-29 17:49

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

相关标签:
3条回答
  • 2021-01-29 18:21

    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

    0 讨论(0)
  • 2021-01-29 18:38

    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

    0 讨论(0)
  • 2021-01-29 18:47

    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.

    0 讨论(0)
提交回复
热议问题