我正在从一个SVN位置检出一个文件夹到3个不同的VM上。文件夹" MakeBelieve"必须检查出来。所以我使用Groovy语法:
checkout([
$class: 'SubversionSCM',
additionalCredentials: [],
excludedCommitMessages: '',
excludedRegions: '',
excludedRevprop: '',
excludedUsers: '',
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: '',
locations: [[credentialsId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
depthOption: 'infinity',
ignoreExternalsOption: true,
local: 'MakeBelieve',
remote: 'svn_url_to_be_removed']],
workspaceUpdater: [$class: 'CheckoutUpdater']])
在2台计算机上的3台虚拟机中,它被检出MakeBelieve。但是在其中一台机器上,它被检查为MakeBelieve @ 2。不知道为什么会这样。平行阶段表述为:
stage('Check Out Code') {
parallel {
stage('Checkout in Machine1') {
agent {
label "Machine1"
}
steps {
echo 'Check out code '
checkout([$class: 'SubversionSCM',
additionalCredentials: [],
excludedCommitMessages: '',
excludedRegions: '',
excludedRevprop: '',
excludedUsers: '',
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: '',
locations: [[credentialsId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
depthOption: 'infinity',
ignoreExternalsOption: true,
local: 'MakeBelieve',
remote: 'svn_url']],
workspaceUpdater: [$class: 'CheckoutUpdater']])
}
}
stage('Checkout in Machine2') {
agent {
label "Machine2"
}
steps {
echo 'Check out code in'
checkout([$class: 'SubversionSCM',
additionalCredentials: [],
excludedCommitMessages: '',
excludedRegions: '',
excludedRevprop: '',
excludedUsers: '',
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: '',
locations: [[credentialsId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
depthOption: 'infinity',
ignoreExternalsOption: true,
local: 'MakeBelieve',
remote: 'svn_url']],
workspaceUpdater: [$class: 'CheckoutUpdater']])
}
}
stage('Checkout in Machine3') {
agent {
label "Machine3"
}
steps {
echo 'Check out code in'
checkout([$class: 'SubversionSCM',
additionalCredentials: [],
excludedCommitMessages: '',
excludedRegions: '',
excludedRevprop: '',
excludedUsers: '',
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: '',
locations: [[credentialsId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
depthOption: 'infinity',
ignoreExternalsOption: true,
local: 'MakeBelieve',
remote: 'svn_url']],
workspaceUpdater: [$class: 'CheckoutUpdater']])
}
}
}
}
文件夹应该具有相同的名称,而不是2台机器具有正确的文件夹,最后一台机器将被签出为MakeBelieve @ 2。我需要它成为MakeBelieve。
答案 0 :(得分:1)
我认为这是由于并发构建。对于已经在进行中的每个构建,Jenkins将“@#concurrent build”附加到工作区文件夹(我没有对此的引用,只是观察我自己的设置)。也许这个问题可以解决你的问题:
How do I prevent two pipeline jenkins jobs of the same type to run in parallel on the same node?