Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54638

P4 Plugin: "cleanup true" missing cleaning other P4Clients during Parallel Stages

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • P4 Plugin: 1.9.4
      Jenkins: 2.138.3

      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.

        1. screenshot-1.png
          21 kB
          Xuezhong Yan
        2. screenshot-2.png
          23 kB
          Xuezhong Yan

            p4paul Paul Allen
            jackyim Xuezhong Yan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: