1

I run a pipeline using Jenkins scripts written using DSL commands. The problem arise when suddenly one of the stages fail unpredictably with the following error:

Failed to parse D:\newjenkins\jobs\JOB_NAME\builds\166\changelog1.xml

The script I use is as follows:

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 '
                }        
            }
        }           
    }
}

This is a sample script I use. This tends to throw the error highlighted above. Jenkins issue I mostly set the mode of checking out scripts to "svn update as much as possible " but it does not solve anything. Why does this fail? What are the possible ways to avoid this issue?

Edit: The checkout for pipeline I am using is:- Checkout groovy script for execution

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Sourajyoti Bose
  • 83
  • 2
  • 10

1 Answers1

0

It seems there is open issue around this Exceptions by parallel SCM checkout. Most likely the issue is with Jenkins Pipeline plugins itself. I am not sure if this will solve the problem from but looking at one of the comments on open bug you can try Resource lock

Yogesh
  • 4,546
  • 2
  • 32
  • 41
  • Using sleep is a sort of a workaround the issue. However using "sleep 5 seconds" works in one script while in the other case it keeps throwing a **WorkflowScript: 59: Not a valid stage section definition: "sleep 7 SECONDS"** error – Sourajyoti Bose Mar 06 '18 at 08:27