I'm trying to setup a Jenkins build that syncs SVN to a given changelist and then builds code for various different configurations in parallel. I have a prebuild step that needs to be run once per agent regardless of how many builds that agent will build. My current declarative pipeline looks like this:
pipeline {
agent none
stages
{
stage('parallel')
{
failFast true
parallel
{
stage('Release')
{
agent {
label {
label "windows"
}
}
steps
{
checkout([$class: 'SubversionSCM',
additionalCredentials: [],
excludedCommitMessages: '',
excludedRegions: '',
excludedRevprop: '',
excludedUsers: '',
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: '',
locations: [[credentialsId: 'SVN',
depthOption: 'infinity',
ignoreExternalsOption: false,
local: '.',
remote: 'https://my-repo']],
workspaceUpdater: [$class: 'UpdateUpdater']])
bat 'Prebuild.bat'
bat 'msbuild Game/Code/Application.sln "Release|x64"'
}
}
stage('Debug Optimized')
{
agent {
label {
label "windows"
}
}
steps
{
checkout([$class: 'SubversionSCM',
additionalCredentials: [],
excludedCommitMessages: '',
excludedRegions: '',
excludedRevprop: '',
excludedUsers: '',
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: '',
locations: [[credentialsId: 'SVN',
depthOption: 'infinity',
ignoreExternalsOption: false,
local: '.',
remote: 'https://my-repo']],
workspaceUpdater: [$class: 'UpdateUpdater']])
bat 'Prebuild.bat'
bat 'msbuild Game/Code/Application.sln "Debug Optimized|x64"'
}
}
}
}
}
}
While this works a) it's unmaintainable (I have about 20 configs to build in reality, and I don't want to maintain 20 copies of my scm settings), b) it's running the checkout/prebuild once per stage rather than once per agent. I notice there is a default checkout for agents, but as far as I can tell this doesn't work with SVN.
Is there a better way of doing parallel stages than this?