What is the programmatic way to disconnect a node in Jenkins?

前端 未结 2 763
北恋
北恋 2021-01-15 04:52

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 t

2条回答
  •  执念已碎
    2021-01-15 05:02

    I don't see anything in the pipeline-model-definition-plugin regarding node management.

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

    • The Jenkins API for disconnect is:

      http://[jenkins_url]:8080/computer/[slave_name]/doDisconnect?offlineMessage=bye
      
    • Making a Jenkins API call from a pipeline is done through the JENKINS HTTP Request Plugin:

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

提交回复
热议问题