在Jenkins中断开节点的编程方式是什么? [英] What is the programmatic way to disconnect a node in Jenkins?

查看:176
本文介绍了在Jenkins中断开节点的编程方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过使用Jenkins API的脚本来完成,相当于手动单击Jenkins节点管理页面上的断开连接"链接.我想将此代码添加到使用Pipeline脚本插件制作的脚本中.

I want to accomplish, through a script using the Jenkins API, the equivalent of manually clicking on the "Disconnect" link on the node management page in Jenkins. I want to add this code to a script I made using the Pipeline scripting plugin.

换句话说,作为具有Jenkins管理员权限的用户,请执行

In other words, as a user with Jenkins admin privileges, do

Manage Jenkins -> Manage Nodes -> Click on a node -> Click on "Disconnect"

如:

我不想做暂时将此节点标记为脱机"的等效操作.
这对我没有用.

I do not want to do the equivalent of "temporarily mark this node as offline".
That is not useful to me.

推荐答案

关于节点管理的管道模型定义插件.

因此,另一种方法是通过Jenkins API从管道调用断开操作.

So an alternative approach would be to call the disconnect action through the Jenkins API from the pipeline.

http://[jenkins_url]:8080/computer/[slave_name]/doDisconnect?offlineMessage=bye

  • 从管道中进行 Jenkins API调用是通过

  • Making a Jenkins API call from a pipeline is done through the JENKINS HTTP Request Plugin:

    def response = httpRequest "http://..."
    

  • 这篇关于在Jenkins中断开节点的编程方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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