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.
[JENKINS-54638] P4 Plugin: "cleanup true" missing cleaning other P4Clients during Parallel Stages
Description |
New:
Hi, |
Description |
Original:
Hi, |
New:
I have the following pipelines which using parallel stage to checkout source codes from Perforce: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} |
Description |
Original:
I have the following pipelines which using parallel stage to checkout source codes from Perforce: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} |
New:
I have the following pipelines which using parallel stage to checkout source codes from Perforce for Sonar and UT: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} |
Description |
Original:
I have the following pipelines which using parallel stage to checkout source codes from Perforce for Sonar and UT: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} |
New:
I have the following pipelines which using parallel stage to checkout source codes from Perforce for Sonar and UT: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} I expected both P4CLIENT will be deleted after the job execution, but when I see the log, *ONLY* one is deleted, see attached files. |
Attachment | New: screenshot-1.png [ 45163 ] |
Attachment | New: screenshot-2.png [ 45164 ] |
Description |
Original:
I have the following pipelines which using parallel stage to checkout source codes from Perforce for Sonar and UT: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} I expected both P4CLIENT will be deleted after the job execution, but when I see the log, *ONLY* one is deleted, see attached files. |
New:
I have the following pipelines which using parallel stage to checkout source codes from Perforce for Sonar and UT: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} 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. BTW: I checked the P4 code, would the following code be the possible cause? p4-plugin\src\main\java\org\jenkinsci\plugins\p4\tagging\TagAction.java {code:java} /** * Find the last action; use this for environment variable as the last action has the latest values. * * @param run The current build * @return Action */ public static TagAction getLastAction(Run<?, ?> run) { List<TagAction> actions = lastActions(run); if (actions == null) { return null; } // #Review 21165 TagAction tagAction = run.getAction(TagAction.class); for (TagAction t : run.getActions(TagAction.class)) { tagAction = (t != null) ? t : tagAction; } return tagAction; } {code} !screenshot-1.png|thumbnail! !screenshot-2.png|thumbnail! |
Assignee | New: Paul Allen [ p4paul ] |
Description |
Original:
I have the following pipelines which using parallel stage to checkout source codes from Perforce for Sonar and UT: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} 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. BTW: I checked the P4 code, would the following code be the possible cause? p4-plugin\src\main\java\org\jenkinsci\plugins\p4\tagging\TagAction.java {code:java} /** * Find the last action; use this for environment variable as the last action has the latest values. * * @param run The current build * @return Action */ public static TagAction getLastAction(Run<?, ?> run) { List<TagAction> actions = lastActions(run); if (actions == null) { return null; } // #Review 21165 TagAction tagAction = run.getAction(TagAction.class); for (TagAction t : run.getActions(TagAction.class)) { tagAction = (t != null) ? t : tagAction; } return tagAction; } {code} !screenshot-1.png|thumbnail! !screenshot-2.png|thumbnail! |
New:
I have the following pipelines which using parallel stage to checkout source codes from Perforce for Sonar and UT: {code:groovy} #!/usr/bin/env groovy pipeline { agent any 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 } {code} 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. !screenshot-1.png|thumbnail! !screenshot-2.png|thumbnail! |