I have the following pipelines which using parallel stage to checkout source codes from Perforce for Sonar and UT:
#!/usr/bin/env groovy pipeline { agent any options { timestamps() skipDefaultCheckout() } stages { stage('P4 Parallel Checkout Test') { failFast true parallel { stage('UT') { steps { script { def p4Client = "jenkins-${JOB_NAME}-UT" checkout perforce(credential: "P4", populate: forceClean(have: true, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: true), workspace: streamSpec(charset: 'none', format: "${p4Client}", pinHost: false, streamName: "//Stream/devStream")) } } post { always { script { echo "delete P4CLIENT UT" cleanup true } } } } stage('Sonar') { steps { script { def p4Client = "jenkins-${JOB_NAME}-Sonar" checkout perforce(credential: "P4", populate: forceClean(have: true, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: true), workspace: streamSpec(charset: 'none', format: "${p4Client}", pinHost: false, streamName: "//Stream/devStream")) } } post { always { script { echo "delete P4CLIENT Sonar" cleanup true } } } } } // end parallel } } // end stges }
I expected both P4CLIENT will be deleted after the job execution, but when I see the log, ONLY one is deleted. The log showed that one "cleanup" step didn't get the P4CLIENT correctly. See attachments for details.