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

p4publish step fails when using 'paths' argument with multiple paths and there are no changes.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • p4-plugin
    • P4 Plugin Version1.13.3

      When using p4publish with multiple paths listed in the `paths` argument, and the workspace doesn't contain any changes compared to the depot, publish will fail with

      Unable to publish workspace: hudson.AbortException: P4JAVA: Error(s):
      No file(s) to reconcile.

      This seems to be a result of a check in ClientHelper.java

      getValidate().check(status, "- no file(s) to reconcile", "instead of", "empty, assuming text", "also opened by");

      which apparently should ignore the p4java status "- no file(s) to reconcile" but when reconciling with multiple paths, the message is "No file(s) to reconcile." - this can be easily tested from the command line:

      > p4 rec foo/...
      foo/... - no file(s) to reconcile.
      > p4 rec foo/... bar/...
      No file(s) to reconcile.

       

      The attached patch changes the ignore string so that it's recognized in both cases, as the check uses StringUtils.containsIgnoreCase(msg, istring) to compare the message with it.

          [JENKINS-72335] p4publish step fails when using 'paths' argument with multiple paths and there are no changes.

          Karl Wirth added a comment -

          Thank you very much for letting us know  abannerth  and providing a patch.

          I  confirm I can reproduce this.

          Reproduction Steps:

          (1) Create a depot path called //depot/TwoFolders and and files in two subfolders:

          mkdir TwoFolders
          mkdir TwoFolders/src
          echo test >TwoFolders/src/test1
          mkdir TwoFolders/bin
          echo test >TwoFolders/bin/test2
          p4 reconcile
          p4 submit -d "adding two test files" 

          (2) Create following Jenkins job (replace credential with your credential):

          pipeline {
            agent any
            options { skipDefaultCheckout() }
            stages {
              stage("Test") {
                steps {
                  script {
                      echo "In script."
                      checkout perforce(credential: 'JenkinsMaster', populate: autoClean(delete: true, modtime: false, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: false, replace: true, tidy: false), workspace: manualSpec(charset: 'none', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: true, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '''//depot/TwoFolders/... //${P4_CLIENT}/...''')))
                  }
                }
              }
              stage("Publish") {
                steps {
                  script {
                      echo "In Publish script."
                      echo "No changes tp detect."
                      p4publish credential: 'JenkinsMaster', publish: shelve(delete: false, description: 'Shelved by Jenkins. Build: ${BUILD_TAG}', modtime: false, onlyOnSuccess: false, paths: '''src/...
          bin/...''', revert: false), workspace: manualSpec(charset: 'none', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: true, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '//depot/TwoFolders/... //${P4_CLIENT}/...'))                    }
                }
              } 
            }
          }
           

          (3) Run above . It will fail with:

          P4 Task: establishing connection.
          ... server: localhost:1666
          ... node: vm-kwirth-swarm231-bionic-https-extP4 Task: reconcile files to changelist.
          ... p4 revert -k //jenkins-master-Publish_Pipeline-0/src/... //jenkins-master-Publish_P___ +
          ... p4 sync -k //jenkins-master-Publish_Pipeline-0/src/... //jenkins-master-Publish_Pip___ +
          ... p4 reconcile -e -a -f -t //jenkins-master-Publish_Pipeline-0/src/... //jenkins-mast___ -
          
          p4 reconcile -e -a -f -t //jenkins-master-Publish_Pipeline-0/src/... //jenkins-master-Publish_Pipeline-0/bin/...
          No file(s) to reconcile.
          
          Unable to publish workspace: hudson.AbortException: P4JAVA: Error(s):
          No file(s) to reconcile.P4 Task: attempt: 1 

          I will let the developers know.

           

           

          Karl Wirth added a comment - Thank you very much for letting us know  abannerth   and providing a patch. I  confirm I can reproduce this. Reproduction Steps: (1) Create a depot path called //depot/TwoFolders and and files in two subfolders: mkdir TwoFolders mkdir TwoFolders/src echo test >TwoFolders/src/test1 mkdir TwoFolders/bin echo test >TwoFolders/bin/test2 p4 reconcile p4 submit -d "adding two test files" (2) Create following Jenkins job (replace credential with your credential): pipeline {   agent any   options { skipDefaultCheckout() }   stages {     stage( "Test" ) {       steps {         script {             echo "In script."             checkout perforce(credential: 'JenkinsMaster' , populate: autoClean(delete: true , modtime: false , parallel: [enable: false , minbytes: '1024' , minfiles: '1' , threads: '4' ], pin: '', quiet: false , replace: true , tidy: false ), workspace: manualSpec(charset: ' none ', cleanup: false , name: ' jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER} ', pinHost: false , spec: clientSpec(allwrite: false , backup: true , changeView: ' ', clobber: true , compress: false , line: ' LOCAL ', locked: false , modtime: false , rmdir: false , serverID: ' ', streamName: ' ', type: ' WRITABLE ', view: ' '' //depot/TwoFolders/... //${P4_CLIENT}/...' '')))         }       }     }     stage( "Publish" ) {       steps {         script {             echo "In Publish script."             echo "No changes tp detect."             p4publish credential: 'JenkinsMaster' , publish: shelve(delete: false , description: 'Shelved by Jenkins. Build: ${BUILD_TAG}' , modtime: false , onlyOnSuccess: false , paths: '''src/... bin/... ''', revert: false ), workspace: manualSpec(charset: ' none ', cleanup: false , name: ' jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER} ', pinHost: false , spec: clientSpec(allwrite: false , backup: true , changeView: ' ', clobber: true , compress: false , line: ' LOCAL ', locked: false , modtime: false , rmdir: false , serverID: ' ', streamName: ' ', type: ' WRITABLE ', view: ' //depot/TwoFolders/... //${P4_CLIENT}/...'))                    }       }     }    } } (3) Run above . It will fail with: P4 Task: establishing connection. ... server: localhost:1666 ... node: vm-kwirth-swarm231-bionic-https-extP4 Task: reconcile files to changelist. ... p4 revert -k //jenkins-master-Publish_Pipeline-0/src/... //jenkins-master-Publish_P___ + ... p4 sync -k //jenkins-master-Publish_Pipeline-0/src/... //jenkins-master-Publish_Pip___ + ... p4 reconcile -e -a -f -t //jenkins-master-Publish_Pipeline-0/src/... //jenkins-mast___ - p4 reconcile -e -a -f -t //jenkins-master-Publish_Pipeline-0/src/... //jenkins-master-Publish_Pipeline-0/bin/... No file(s) to reconcile. Unable to publish workspace: hudson.AbortException: P4JAVA: Error(s): No file(s) to reconcile.P4 Task: attempt: 1 I will let the developers know.    

          Sandeep Kumar added a comment -

          Fix for this is available in P4 1.16.0

          Sandeep Kumar added a comment - Fix for this is available in P4 1.16.0

            skumar7322 Sandeep Kumar
            abannerth Akos
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: