I have a project which features tests which only run on Linux and other tests which only run on Windows.
I have a Linux agent and a Windows agent. I need to check out the project (and its multiple dependencies) on both agents before I can run the tests on their respective agents.
What's the best method of doing this without repeating code?
I've managed to get a matrix block working like so:
stage('SCM Checkout Matrix')
{
matrix {
axes {
axes {
name 'AGENT'
values 'builtin', 'jenkins-uk-win7'
}
}
stages {
stage("SCM Checkout") {
options {
lock( 'synchronous-matrix' )
}
agent {label "${AGENT}"}
steps {
<many git checkouts in here>
}
}
}
}
But this seems hideously complicated and also makes the dashboard horribly messy:

I've also tried defining multiple agent labels with the && operator:
agent(label 'builtin && jenkins-uk-win7')
as described here but it complains that there isn't an agent called 'builtin && jenkins-uk-win7'.
I've studied this post where people appear to be having similar problems to me regarding use of &&.
Surely this is a pretty elementary thing to do? Am I overlooking something painfully obvious?