我使用使用 DSL 命令编写的 Jenkins 脚本运行管道。当某个阶段突然出现以下错误时,问题出现了:
Failed to parse D:\newjenkins\jobs\JOB_NAME\builds\166\changelog1.xml
我使用的脚本如下:
pipeline{
agent none
parameters{
...
}
stages('Execution Started'){
stage('Checkout'){
parallel{
stage('Checkout machine1'){
agent{
label "machine1"
}
when{
beforeAgent true
expression { return params.MODULE == 'ALL' || params.MODULE == 'Checkout'}
}
steps{
echo "machine1"
checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[credentialsId: '44522e30-239d-4b35-bf11-41f02778026f', depthOption: 'infinity', ignoreExternalsOption: true, local: 'location_checkout_1', remote: 'url_checkout_1'], [credentialsId: '44522e30-239d-4b35-bf11-41f02778026f', depthOption: 'infinity', ignoreExternalsOption: true, local: 'location_checkout', remote: 'url_checkout']], quietOperation: false, workspaceUpdater: [$class: 'CheckoutUpdater']])
}
}
stage('Checkout machine2'){
agent{
label "machine2"
}
when{
beforeAgent true
expression { return params.MODULE == 'ALL' || params.MODULE == 'Checkout'}
}
steps{
echo "machine2"
checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[credentialsId: '44522e30-239d-4b35-bf11-41f02778026f', depthOption: 'infinity', ignoreExternalsOption: true, local: 'location_checkout_1', remote: 'url_checkout_1'], [credentialsId: '44522e30-239d-4b35-bf11-41f02778026f', depthOption: 'infinity', ignoreExternalsOption: true, local: 'location_checkout', remote: 'url_checkout']], quietOperation: false, workspaceUpdater: [$class: 'CheckoutUpdater']])
}
}
stage('Checkout machine3'){
agent{
label "machine3"
}
when{
beforeAgent true
expression { return params.MODULE == 'ALL' || params.MODULE == 'Checkout'}
}
steps{
echo "machine3"
checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[credentialsId: '44522e30-239d-4b35-bf11-41f02778026f', depthOption: 'infinity', ignoreExternalsOption: true, local: 'location_checkout_1', remote: 'url_checkout_1'], [credentialsId: '44522e30-239d-4b35-bf11-41f02778026f', depthOption: 'infinity', ignoreExternalsOption: true, local: 'location_checkout', remote: 'url_checkout']], quietOperation: false, workspaceUpdater: [$class: 'CheckoutUpdater']])
}
}
}
}
}
stage('Build'){
parallel{
stage('Build at machine1'){
agent{
label "machine1"
}
when{
beforeAgent true
expression { return params.MODULE == 'ALL' || params.MODULE == 'Checkout' || params.MODULE == 'Build'}
}
steps{
echo "machine1"
bat 'cd location_machine && ant main '
}
}
stage('Build at machine2'){
agent{
label "machine2"
}
when{
beforeAgent true
expression { return params.MODULE == 'ALL' || params.MODULE == 'Checkout' || params.MODULE == 'Build'}
}
steps{
echo "machine2"
bat 'cd location_machine && ant main '
}
}
stage('Build at machine3'){
agent{
label "machine3"
}
when{
beforeAgent true
expression { return params.MODULE == 'ALL' || params.MODULE == 'Checkout' || params.MODULE == 'Build'}
}
steps{
echo "machine3"
bat 'cd location_machine && ant main '
}
}
}
}
}
这是我使用的示例脚本。这往往会引发上面突出显示的错误。
我主要将检查脚本的模式设置为“尽可能多地更新 svn”,但这并不能解决任何问题。为什么会失败?有哪些可能的方法来避免这个问题?