Jenkins中的资源管理外部节点以进行测试 [英] Resource mange external nodes in Jenkins for tests

查看:133
本文介绍了Jenkins中的资源管理外部节点以进行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我的代码需要重新启动节点.我有许多长时间运行的Jenkins测试作业,需要在重新启动的节点上执行.

My problem is that I have code that need a rebooted node. I have many long running Jenkins test jobs that needs to be executed on rebooted nodes.

我现有的解决方案是在Jenkins中定义多个具有相同标签(TestLable)的代理"计算机,每台计算机有1个执行程序.我将所有测试作业绑定到标签(TestLable).在测试执行脚本中,我检测到Jenkins机器(Jenkins env.NODE_NAME),并使用该机器知道测试应使用的物理物理机器.

My existing solution is to define multiple "proxy" machines in Jenkins with the same label (TestLable) and 1 executor per machine. I bind all the test jobs to the label (TestLable). In the test execution script I detect the Jenkins machine (Jenkins env. NODE_NAME) and use that to know what physical physical machine the tests should use.

有人知道更好的解决方案吗?

Do anybody know of a better solution?

以上方法有效,但是我需要定义大量不需要的节点/机器".我想要的是一个能够向Jenkins工作授予令牌的插件.这样,在詹金斯执行器和令牌释放之前,将不会执行作业.令牌应该是一个字符串,以便我的测试作业可以使用它来知道它可以使用哪个外部节点.

The above works but I need to define a high number of "nodes/machines" that may not be needed. What I would like was a plugin that would be able to grant a token to a Jenkins job. This way a job would not be executed before a Jenkins executor and a token was free. The token should be a string so that my test jobs could use it to know what external node it could use.

推荐答案

我们已经编写了自己的调度程序,用于在启动Jenkins节点之前分配内容.可能有更好的解决方案-但这对我们大多数有效.我还没有遇到可以处理各种硬件资源的复杂分配的现成调度程序.我们有n个框类型,分配给n个构建类型.

We have written our own scheduler that allocates stuff before starting Jenkins nodes. There may be a better solution - but this works for us mostly. I've yet to come across an off-the-shelf scheduler that can deal with complicated allocation of different hardware resources. We have n box types, allocated to n build types.

我们拥有的某些构建类型在不破坏所有持久数据的情况下是不兼容的-由于收集时间很长,可能需要使用这些构建类型.某些作业需要这些硬件类型的组合.我们将详细信息存储在数据库中,然后使用业务逻辑来确定如何进行分配.我们经常发现,特定的工作类型需要额外的业务逻辑或额外的数据字段来满足其特定要求.

Some build types we have are not compatible together without destroying all persistent data - which may be required as it takes a long time to gather. Some jobs require combinations of these hardware types. We store the details in a DB, and then use business logic to determine how it is allocated. We've often found that particular job types need additional business logic or extra data fields to account for their specific requirements.

因此,最好的方法是使用自己选择的语言来编写自己的调度程序,并考虑到您的特定需求.

So it may be the best way is to write your own scheduler, in your own language of choice, which takes into account your particular needs.

这篇关于Jenkins中的资源管理外部节点以进行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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