当前,我正在尝试遍历当前在线Jenkins从站的结果,以便在每个内部执行命令,但是目前,我不确定我会缺少什么,因为基于可用的代理无法按预期工作。
这是我正在使用的当前代码:
pipeline {
agent any
stages {
stage('Deploy') {
steps {
script {
def jenkins = Jenkins.instance
def computers = jenkins.computers
agents = [:]
for (i in computers) {
// Printing the output works,
echo "${i.displayName}"
if (i.hostName) {
// this doesn't works
agents["${i.displayName}"] = {
echo 'this would be executed'
}
// end
}
}
parallel agents
}
}
}
}
}