On Mon, Aug 17, 2020 at 12:26 AM Sébastien Hinderer <
[email protected]> wrote:
> Dear all,
>
> In our legacy matrix jobs we use the elastic axis plugin quite a lot.
>
> This plugin creates a matrix axis from a label: all the nodes with the
> given label will be on the axis and thus the given job can be run on all
> these nodes.
>
> However, the elastic axis plugin does not provide any pipeline step.
> Is there another known way to achieve this in a pipeline, please?
>
> Many thanks in advance for any hint,
>
>
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)
}
I don't know if that will help in your case, but it was a first
step to meet my needs. I have many jobs that need the
same transformation.
Sébastien.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/20200817062618.GA170986%40om.localdomain
> .
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFmGVTnMHsts8Pbc%2Bh_bVFi3pAOUrtx0AxbdskSdALk6Q%40mail.gmail.com.