I really like the elastic axis plugin for many of the things I need to do.
Unfortunately, it doesn't handle offline agents as well as I'd like.
I use the following pipeline code to replace a job that was using
elastic axis and was blocking because some agents were offline:
def nodes = nodesByLabel label: 'windows || linux || openbsd || freebsd'
nodes = nodes.sort()
Map tasks = [:]
for (int i = 0; i < nodes.size(); i++) {
def label = nodes[i]
def stageName = 'Clean ' + label.replaceAll('(-jagent)|(-ssh)|(-mwaite)|(.
markwaite.net)|(-beemarkwaite)|(-jenkins)', '')
tasks[label] = {
node(label) {
stage(stageName) {
checkout scm
withAnt(installation: 'ant-latest', jdk: 'jdk8') {
if (isUnix()) {
sh 'ant clean'
} else {
bat 'ant clean'
}
}
}
}
}
}
timeout(time: 13, unit: 'MINUTES') {
parallel(tasks)
}
same transformation.