使用groovy脚本运行时,Jenkins会抛出Buildlog错误

时间:2018-03-05 06:11:37

标签: jenkins jenkins-pipeline jenkins-2 jenkins-groovy

我使用使用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 '
                }        
            }
        }           
    }
}

这是我使用的示例脚本。这往往会抛出上面突出显示的错误。 Jenkins issue 我主要设置检查脚本的模式为“svn尽可能更新”,但它没有解决任何问题。为什么这会失败?有什么方法可以避免这个问题?

编辑: 我正在使用的管道结帐是: - Checkout groovy script for execution

1 个答案:

答案 0 :(得分:0)

这个Exceptions by parallel SCM checkout似乎存在未解决的问题。最有可能的问题是Jenkins Pipeline插件本身。我不确定这是否可以解决问题但是看一下有关开放bug的评论你可以尝试Resource lock