What is the best way to create and install test environments (Amazon EC2) with Jenkins

I am trying to automate the process of creating a test environment. I am using Jenkins as my CI server and want to be able to create new virtual machine instances (based on a predefined template) on AmazonEC2. I know there is a plugin for it if you want to use VM as slen devices to build jenkins. But I want to use the VM as a ready-to-use test environment where the build artifacts will be deployed. So the question is, what's the best approach? I am currently thinking about using Chef to set up new virtual machine instances, but how to create the virtual machine itself is a mystery. Any help is appreciated. Thank.

+3


source to share


4 answers


It sounds like you want something like Test-Kitchen . You can use chef and kitchen-ec2 to deploy the machine, run the recipe code, and then run some tests on it (usually servers or bats, but there are many test drivers). You will be running the test kitchen from the owner Jenkins himself, so Jenkins doesn't have to worry about creating new instances.



+1


source


Ansible has good support for creating Amazon EC2 instances, etc. For more information see this link . You can also use ansible to fully automate the deployment of your application and also after the EC2 instance is created.



+1


source


Take a look at Ansible for deployment automation. What we are doing is Ansible provision new vm and then use a chef / puppet to configure the management of the environment's existing codebase. It works wonderfully!

Here's an example of a game bar architecture:

---
- hosts: localhost
  connection: local
  gather_facts: True
  roles:
     - load_balancer
     - cloud_servers

- hosts: infra
  gather_facts: True 
  roles: 
     - deploy

- hosts: localhost
  connection: local
  gather_facts: True
  roles:
     - test
     - clean_up

      

0


source


You can use Vagrant to create a virtual machine via the Vagrant plugin on Jenkins. https://wiki.jenkins-ci.org/display/JENKINS/Vagrant-plugin

Vagrant is a kind of virtualization wrapper (for wmare, virtualbox, lxc) that allows you to customize the configuration for your virtual machine and choose between several options:

  • Provisionner: Ansible, Chef ...
  • Synchronized folder between host and guest
  • Network Settings ...

https://docs.vagrantup.com/v2/

0


source







All Articles