使用Ansible,Jenkins和docker构建快速测试环境 [英] Using Ansible,Jenkins and docker to build fast test environments

查看:308
本文介绍了使用Ansible,Jenkins和docker构建快速测试环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在计划使用ansible,jenkins和docker构建测试环境。这个计划就是这样的。您的环境并将其存储在git上。
使用jenkins创建作业以在dev服务器上创建docker容器,并使用可调用的playbook来配置Docker容器。
Jenkins的作业将被创建,以便用户可以选择选择要与Docker容器一起使用的剧本,并相应地构建容器。



整个概念可以总结如下图所示。





我看到的是



自动复制精确的生产环境。

根据需求扩展测试环境。

提供不同的平台用于单个服务器上的应用程序测试。

更快的集成测试。

提升敏捷方法。

自由开发和自定义测试环境。

开发人员和测试人员可以自己创建环境,即使他们不了解任何操作系统,配置。

在干净的环境中测试应用程序的部署,一个新鲜的建立。



有没有人实现这种类型的环境架构,我想讨论一下可行性的实际好处。

解决方案

我使用的是类似但不同的方法:




  • 定义Dockerfiles或厨师/ puppet / ansible / salt配置。在您的方法中。


  • 将这些描述放在版本控制下。与您的方法一样。


  • 使用Jenkins A进行CI和夜间构建图像,并将其上传到注册表中。为了管理不同的版本和保留旧的图像。这在图中引入了一个图像注册表。


  • 使用Jenkins-Swarm从站扩展这些图像。这可以在您的Jenkins环境中进行临时部署。




这里我将软件的构建与建立建立奴隶本身。




  • 我部署了Jenkins B以在环境中构建软件。


  • 现在我选择要永久部署的容器,并构建我要部署的容器。




    • 建筑工作大量使用的永久性集装箱是作为群众奴隶开始的,每天通过夜间建造进行交换。

    • 专用集装箱由Jenkins-Docker插件。

    • 对于更复杂的环境配置,我使用docker-compose来管理临时可用性。

    • 对于ad-hoc环境,即虚拟机对于运行这些配置,我使用docker-swarm。




图:


I am planning to build test environment using ansible, jenkins and docker together.The plan is like this.

Create ansible playbooks for every tool that you are using in your environment and store them on git. Using jenkins create job to create docker containers on dev server and use ansible playbooks for provisioning the docker containers. Jenkins jobs will be created so that user will have option to select playbooks that they want to use with docker containers and containers will be built accordingly.

whole concept can be summarized as shown is below image.

The benefits i see are

Automatic replication of exact production environments.
Scale your test environment as per requirement.
Provide different platforms for application testing on a single server.
Faster integration testing.
Promote agile methodology.
Freedom to develop and customize the test environment.
Developers and testers can create environments on their own even if they don't know anything regarding OS,configuration.
Test the deployment of the app in a clean environment, a fresh build.

Has any one implemented such type of environment architecture,i would like to discuss the feasibility actual benefits of the same.

解决方案

I am using a similar but different approach:

  • Define Dockerfiles or chef/puppet/ansible/salt provisioning. As in your approach.

  • Putting those descriptions under version control. As in your approach.

  • Using Jenkins A to CI- and Nightly Building Images and Uploading them into a registry. In order to manage different versions and keeping old images. This introduces a image registry in your diagram.

  • Extending those images with Jenkins-Swarm slaves. This enables ad-hoc deployment in your Jenkins environment.

Here I separate between building of the software and the building of the build slaves themselves.

  • I deploy a Jenkins B in order to build the software on environments.

  • Now I choose between container that I want to deploy permanently and build containers I want to deploy on demand.

    • Permanent containers, which are heavily used by build jobs, are started as swarm slaves and exchanged daily by nightly builds.
    • Ad-hoc containers are managed by the Jenkins-Docker-Plugin.
    • For more complex environment configurations I use docker-compose to manage ad-hoc availability.
    • For ad-hoc environments, namely VMs for running those configurations, I use docker-swarm.

Diagram:

这篇关于使用Ansible,Jenkins和docker构建快速测试环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆