詹金斯在两个奴隶上工作? [英] jenkins job on two slaves?

查看:83
本文介绍了詹金斯在两个奴隶上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要能够运行消耗两个奴隶的詹金斯工作. (或者,两个作业,如果我们可以保证它们同时运行,并且至少有一个可能知道另一个是什么.)这种情况是,我们有一个重量级的应用程序,需要针对它进行测试.测试在一台计算机上运行,​​应用程序在另一台计算机上运行.将它们放在同一主机上是不切实际的.

We need to be able to run a Jenkins job that consumes two slaves. (Or, two jobs, if we can guarantee that they run at the same time, and it's possible for at least one to know what the other is.) The situation is that we have a heavy weight application that we need to run tests against. The tests run on one machine, the application runs on another. It's not practical to have them on the same host.

现在,我们有一个Jenkins作业,该作业使用脚本来启动专用的应用服务器,安装正确的版本,正确的数据,然后对其进行测试.这意味着当没有进行繁重的测试时,我不能使用专用的应用程序服务器来执行其他任务.这也几乎将我们限制在一个循环内.能够动态分配应用服务器将允许更多服务器.

Right now, we have a Jenkins job that uses a script to kick a dedicated application server up, install the correct version, the correct data, and then run the tests against it. That means that I can't use the dedicated application server to run other tasks, when there aren't the heavy weight testing going on. It also pretty much limits us to one loop. Being able to assign the app server dynamically would allow more of them.

在核心詹金斯中显然没有办法做到这一点,但是我希望有一些插件或黑客手段来实现这一目标.当前的测试构建是一个maven 2作业,但是如果我们必须将其包装在其他内容中,则这是可配置的.成功完成另一项工作可以拉开序幕,可以将其更改为开始两项,或执行其他任何要求.

There's clearly no way to do this in the core jenkins, but I'm hoping there's some plugin or hackery to make this possible. The current test build is a maven 2 job, but that's configurable, if we have to wrap it in something else. It's kicked off by the successful completion of another job, which could be changed to start two, or whatever else is required.

推荐答案

让我看看我是否理解了这个问题.

Let me see if I understood the problem.

  1. 您希望动态选择一个从属并在其上启动App Server.

  1. You want to have dynamically choose a slave and start the App Server on it.

当App服务器在从属服务器上运行时,您不希望它运行任何其他作业.

When the App server is running on a Slave you do not want it to run any other job.

但是,当App服务器未运行时,您希望将该Slave用作其他作业的其他Slave.

But when the App server is not running, you want to use that Slave as any other Slave for other jobs.

一种解决方法是标记奴隶.并使用限制可以在哪里运行该项目"来使App Server和Test Suite在带有Slave标签的计算机上运行.

One way out will be to label the Slaves. And use "Restrict where this project can be run" to make the App Server and the Test Suite run on the machines with Slave label.

然后在从属节点中,将#of executors"(执行者数)置为1.这样可以确保在任何时候都只能运行一个Job.

Then in the slave nodes, put " # of executors" to 1. This will make sure that at anytime only one Job will run.

下一步将是创建作业以启动App Server,然后在App Server启动作业成功后启动测试"作业.

Next step will be to create a job to start the App Server and then kick off the Test job once the App Server start job is successful..

如果您的测试作业需要了解运行App服务器的计算机的服务器详细信息,那么它将变得很有趣.

If your test job needs to know the server details of the machine where your App server is running then it becomes interesting.

这篇关于詹金斯在两个奴隶上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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