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

Remove files AND directories when poplulating workspace

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • None

      The following Jenkinsfile snipplet ....

       

      checkout([$class: 'PerforceScm',
        credential: 'mycredentials',
        poll: true,
        changelog: true,
        populate: [$class: 'AutoCleanImpl',
          delete: true,
          modtime: false,  
          parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'],
          pin: '',
          quiet: true,
          replace: true],  
        workspace: [$class: 'ManualWorkspaceImpl',
          charset: 'none',
          name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}',
          pinHost: false,  
          spec: [allwrite: true,
            clobber: false,  
            compress: false,  
            line: 'LOCAL',
            locked: false,  
            modtime: false,  
            rmdir: false,  
            streamName: '',
            view: '//depot/path/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...'
          ]       
        ]       
      ])
      
      

      .... will checkout code and remove any workspace files from the previous build.
      However it will NOT remove any directories that were left from previous builds.
      I have a maven/tycho build that reproducibly fails with this setup:
      it has a local maven repository (in the workspace root). The files in this repository (.repository directory) will be removed when the p4-plugin syncs the files. For some reason (I actually blame the maven-tycho-plugin) it breaks when downloading and unpacking artifacts (P2-artifacts in my case) when the repository-directories already exist, but not the artifacts inside.

      Certainly this is not a p4-plugin bug, but I'd really like to see the option to sync the workspace and have exactly the same result for both syncing for the first time and subsequent syncs.

       

          [JENKINS-50110] Remove files AND directories when poplulating workspace

          Paul Allen added a comment - - edited

          Perforce does not track/version directories; however if Perforce syncs a directory and removes the last file it will delete the directory if the 'rmdir' client option is set:

          rmdir: true,

          Unfortunately, given the situation where the directory is outside the client view Perforce will not touch it.  Have you tried setting 'force clean'.

          Paul Allen added a comment - - edited Perforce does not track/version directories; however if Perforce syncs a directory and removes the last file it will delete the directory if the 'rmdir' client option is set: rmdir: true , Unfortunately, given the situation where the directory is outside the client view Perforce will not touch it.  Have you tried setting 'force clean'.

            Unassigned Unassigned
            fdrueke Felix Drueke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: