詹金斯在码头工人中触发按需的奴隶 [英] Jenkins trigger on-demand slaves in dockers

查看:228
本文介绍了詹金斯在码头工人中触发按需的奴隶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来运行Jenkins工作/在Jenkins奴隶内建立动态(按需)启动码头。附加视觉理解模式。
我正在寻找什么,我的流程如下所示:



1)触发Jenkins作业(手动/ git / gerrit)

2)Jenkins主人(在码头工厂运行)启动从机停靠码头(并通过脚本/构建指令)

3)构建正在Jenkins从站上运行(或者如果并行/管道运行)

4)结果返回给詹金斯大师

5)詹金斯奴隶码头停止





可以这样做吗?

解决方案


  1. Docker从属映像创建步骤,如安装openssh,用户创建,在下面的链接中提到。从以下链接安装Docker插件。



    点击这里


  2. 转到jenkins全局配置,在云标题下,docker配置将在那里,进入docker主机URL端口号,凭证不需要。给出连接超时的一些值读取超时。


  3. 在docker模板下 - 输入我们在点号1中创建的码头图像名称。


  4. 设置标签号(在创建Jenkins作业期间给此标签名称并限制为此从属名称),


  5. 选择使用选项 -


  6. 执行者的数量 - >最小值1.选择启动方法作为ssh,输入用户凭据进行登录,我们创建在码头图像中的步骤1中。


创建一个作业限制到docker从属标签,运行,ondemand它将旋转容器。


I'm looking for a way to run Jenkins jobs/build inside Jenkins slaves, dynamically (on-demand) started docker. Attaching schema for visual understanding. What I'm actually looking for and my flow looks like:

1) Triggering Jenkins job (manually/git/gerrit)
2) Jenkins master (running in docker) starts slave machine docker (and pass script/instructions of the build)
3) Build is running on Jenkins slave (or slaves if parallel/pipeline)
4) Result returned to Jenkins master
5) Jenkins slave docker stops

Is it possible to do it this way?

解决方案

  1. Docker slave image creation steps like installing openssh, user creation, mentioned in the below link. Install docker plugin from the below link.

    Click here!

  2. Go to jenkins global configuration, Under cloud headings, docker configuration will be there, enter docker host url with port number, credential not required. give some values for connection timeout & read timeout.

  3. Under docker template - Enter the docker image name which we created in the point number 1.

  4. Set Label number (Give this label name during Jenkins job creation and restrict to this slave name),

  5. Select the usage option - > only build job with label restriction.

  6. No of executor -> minimum 1. Select launch method as ssh, enter the user credential to login, which we created in docker image in the step number 1.

create a job restrict to docker slave label, run, ondemand it wil spun up container.

这篇关于詹金斯在码头工人中触发按需的奴隶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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