如何獲得有關 Jenkins 例項的資訊

開啟 jenkins 例項指令碼控制檯 http:// yourJenkins:port / script 以下是如何獲取有關此例項的資訊的示例。將程式碼複製到控制檯,然後單擊執行

/* This scripts shows how to get basic information about Jenkins instance */
def jenkins = Jenkins.getInstance()
println "Jenkins version: ${jenkins.getVersion()}"
println "Available JDKs: ${jenkins.getInstance().getJDKs()}"
println "Connected Nodes:"
jenkins.getNodes().each{ 
  println it.displayName
}
println "Configured labels: ${jenkins.getLabels()}"

在此示例中,你將看到有關 Jenkins 版本,JDK,代理(從屬)和標籤的資訊。