问题描述
我正在尝试在Azure中设置"AZure VM Agent"插件.
Am trying to setup "AZure VM Agent" plugin in Azure.
在完成所有配置后,当我第一次触发作业时,Azure上的一个从属被创建并执行该作业.但是,一旦作业执行完成,节点就会进入离线模式.
Am done with all configurations and first time when i trigger a job, a slave on Azure gets created and it executes the job. But as soon as job execution completes, node goes into offline mode.
现在,如果我触发另一个jenkins作业,则脱机节点不会自动联机,因此jenkins作业将停留在等待代理"或代理脱机"状态.一段时间之后,新的代理人来了,这需要花费自己的时间来做好一切准备.
Now if I trigger another jenkins job, offline node is not coming online automatically and so jenkins job is stuck on "waiting for agent" or "agent is offline". After sometime, new agent comes and it takes its own time to get ready and all.
如何在没有任务的情况下将从站配置为脱机,并在新任务可用时立即使用相同的从站节点?
How can I configure slaves to go offline when no task and as soon as new task is available, use same slave node?
推荐答案
节点仅在'n'分钟后才脱机,其中'n'是基于您在Jenkins仪表板中设置的配置(在Manager Jenkins下- >配置系统->云部分).默认情况下,它设置为"60",如下面的屏幕截图所示.如果希望节点继续运行,则必须将其设置为"0".另外,请确保选中保留时间后仅关闭(不删除)"复选框.
Node goes offline only after 'n' number of minutes where 'n' is based on the configuration that you have set in your Jenkins dashboard (under Manager Jenkins -> Configure System -> Cloud section). By default it is set to '60' as shown in below screenshot. You would have to set it to '0' if you want the node to keep running. Also, make sure you tick the box for "Shutdown Only (Do Not Delete) After Retention Time".
我认为最好不要手动配置这些从属设备(例如,通过取消分配/关闭VM或通过在Jenkins仪表板中将节点标记为脱机显式使其脱机),因为如果这样做,那么该节点应该按照保留周期由Azure VM Agents Jenkins插件维护,但是由于它是人为干扰的,因此我们可能会发现诸如"nodelabel由1个节点和1个云服务的问题.插件提供的权限或其他限制可能阻止此作业在那些节点上运行"等.
I believe that it's better to manually not configure these slaves (i.e., by explicitly making it offline by either deallocating / shutting down the VM or by marking the node offline in Jenkins dashboard / etc.) because if we do so then as the node is supposed to be maintained by the Azure VM Agents Jenkins plugin as per the retention cycle but as it is disturbed manually so we may observe issues like "nodelabel is serviced by 1 node and 1 cloud. Permissions or other restrictions provided by plugins may prevent this job from running on those nodes", etc.
希望这些输入有帮助!干杯!
Hope these inputs helps! Cheers!
这篇关于Jenkins:VM Azure代理:节点在工作后脱机并且无法在新任务上自动重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!