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

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

问题描述

我打算用ansible、jenkins和docker一起搭建测试环境.计划是这样的.

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

为您在环境中使用的每个工具创建 ansible playbook,并将它们存储在 git 上.使用 jenkins create job 在开发服务器上创建 docker 容器,并使用 ansible playbooks 来配置 docker 容器.将创建 Jenkins 作业,以便用户可以选择要与 docker 容器一起使用的剧本,并且将相应地构建容器.

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.

我看到的好处是

自动复制精确的生产环境.
根据要求扩展您的测试环境.
为单一服务器上的应用程序测试提供不同的平台.
更快的集成测试.
推广敏捷方法.
自由开发和定制测试环境.
即使对操作系统、配置一无所知,开发人员和测试人员也可以自行创建环境.
在干净的环境中测试应用程序的部署,一个全新的构建.

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:

  • 定义 Dockerfiles 或chef/puppet/ansible/salt 配置.就像你的方法一样.

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

将这些描述置于版本控制之下.就像你的方法一样.

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

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

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.

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

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.

  • 我部署了一个 Jenkins B 以便在环境中构建软件.

  • 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.

  • 构建作业大量使用的永久容器作为群奴隶启动,并通过夜间构建每天交换.
  • 临时容器由 Jenkins-Docker-Plugin 管理.
  • 对于更复杂的环境配置,我使用 docker-compose 来管理临时可用性.
  • 对于临时环境,即用于运行这些配置的虚拟机,我使用 docker-swarm.

示意图:

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

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