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

Checkout to root directory deletes ALL files in the directory

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • subversion-plugin
    • None
    • Jenkins 1.596, subversion-plugin 2.4.5

      When this plugin does a checkout (and on some occasions an update) it first deletes all files and folders in the checkout directory. The delete operation includes files and folders which are unrelated to the svn checkout.

      This causes problems when checking out SonarQube scripts and when using local maven repositories in the workspace. Some maven tasks also require the checkout directory to be the same as the build location.

        1. config.xml
          2 kB
        2. log
          56 kB

          [JENKINS-26443] Checkout to root directory deletes ALL files in the directory

          Daniel Beck added a comment -

          Please provide a sample job configuration and relevant build log excerpts.

          Daniel Beck added a comment - Please provide a sample job configuration and relevant build log excerpts.

          Dave Taddei added a comment -

          Added config.xml and log for the job. Running this job multiple times will show the date of folder .repository changing even though this has been excluded from the workspace delete.

          Removing the SCM checkout this job will fail on the second iteration because .repository is not deleted. The subversion plugin seems to think that there is no workspace and therefore creates a new one from scratch.

          Dave Taddei added a comment - Added config.xml and log for the job. Running this job multiple times will show the date of folder .repository changing even though this has been excluded from the workspace delete. Removing the SCM checkout this job will fail on the second iteration because .repository is not deleted. The subversion plugin seems to think that there is no workspace and therefore creates a new one from scratch.

          Daniel Beck added a comment - - edited

          This only occurs if you delete the workspace manually using Workspace Cleanup, right? Not sure there's a bug here, there's something to be said for resetting to a sane state when nothing is known about workspace contents. Try not deleting the .svn directory.

          Daniel Beck added a comment - - edited This only occurs if you delete the workspace manually using Workspace Cleanup, right? Not sure there's a bug here, there's something to be said for resetting to a sane state when nothing is known about workspace contents. Try not deleting the .svn directory.

          Dave Taddei added a comment -

          I have also tried excluding the .svn folder from the workspace cleanup but the problem persists. I have also tried excluding all .svn folders from the structure but the plugin still deletes everything in the workspace. A workaround for this is possible by checking out the SVN repo into a specific folder in the workspace but this can cause problems with the SonarQube code analysis plugin as it requires the workspace root to be the same as the source directory.

          Dave Taddei added a comment - I have also tried excluding the .svn folder from the workspace cleanup but the problem persists. I have also tried excluding all .svn folders from the structure but the plugin still deletes everything in the workspace. A workaround for this is possible by checking out the SVN repo into a specific folder in the workspace but this can cause problems with the SonarQube code analysis plugin as it requires the workspace root to be the same as the source directory.

          Dave Taddei added a comment -

          Further update, the following combination works:

          1. Workspace cleanup plugin configured to exclude files and directories matching the pattern .svn/**
          2. Subversion plugin configured to do "svn update as much as possible" OR "svn update as much as possible with svn revert before update"

          Using the fresh checkout mode deletes everything in the target directory.

          Correct me if I am wrong but the mode "svn update as much as possible" still has the possibility of deleting the entire Jenkins workspace contents if the plugin decided it needed to do so. I guess the recommended practice should be to always checkout to a specific directory within the Jenkins workspace rather than the workspace root?

          Dave Taddei added a comment - Further update, the following combination works: 1. Workspace cleanup plugin configured to exclude files and directories matching the pattern .svn/** 2. Subversion plugin configured to do "svn update as much as possible" OR "svn update as much as possible with svn revert before update" Using the fresh checkout mode deletes everything in the target directory. Correct me if I am wrong but the mode "svn update as much as possible" still has the possibility of deleting the entire Jenkins workspace contents if the plugin decided it needed to do so. I guess the recommended practice should be to always checkout to a specific directory within the Jenkins workspace rather than the workspace root?

            Unassigned Unassigned
            drtaddei Dave Taddei
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: