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

Git polling deletes files in workspace if "clean" and "ignore commits in path" are both enabled

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins ver. 1.596,
      git-plugin 2.3.5,
      git-client-plugin 1.16.1

      Sample GIT repo with the following content:

      • ./dir1/file1
      • ./dir1/file3
      • ./dir2/file2
      • ./file1
      • ./file2

      When using the following GIT client configuration

      • Clean before checkout
      • Polling ignores commits in certain paths
        • Included: dir1\/.*
        • Excluded: <empty>
      • Sparse checkout paths (this is optional; issue is triggered without as well)
        • Path: dir1

      the GIT client plugin resets the workspace when polling for changes, i.e. removes any files not part of the repository outside regular job runs. This is rather disturbing if one wants to check the workspace after a build for whatever reason and cannot find files created by the previous build anymore because the periodic polling deleted them in the meantime.

          [JENKINS-28529] Git polling deletes files in workspace if "clean" and "ignore commits in path" are both enabled

          Mark Waite added a comment -

          Does it do that only when using "Force polling to use workspace", or does it happen when or not a workspace is already available?

          Mark Waite added a comment - Does it do that only when using "Force polling to use workspace", or does it happen when or not a workspace is already available?

          Ronny Schuetz added a comment -

          "Force polling to use workspace" isn't configured at all, the GIT plugin configuration just contains the 2 resp. 3 "Additional behavior" modules listed above. "Name" and "Refspec" are empty, "Branch specifier" is "master", git executable is not jgit, the git command line version used is "1.8.0.2"

          It happens when a workspace is already available.

          Ronny Schuetz added a comment - "Force polling to use workspace" isn't configured at all, the GIT plugin configuration just contains the 2 resp. 3 "Additional behavior" modules listed above. "Name" and "Refspec" are empty, "Branch specifier" is "master", git executable is not jgit, the git command line version used is "1.8.0.2" It happens when a workspace is already available.

          Mark Waite added a comment - - edited

          I've verified that the problem is repeatable if an exclusion path is defined in the job and "clean before checkout" is enabled.

          My test case was:

          1. Create a git repository with an ant build script that creates a temporary file as its default target
          2. Define a Jenkins job which monitors that repository and runs the ant build script, confirm the workspace has the temporary file after polling
          3. Enable "clean before checkout" on that Jenkins job, confirm the workspace has the temporary file after polling
          4. Enable path exclusion on the Jenkins job, confirm that the temporary file is deleted from the workspace by the next poll

          A docker instance now includes a pair of sample jobs which verify this is still a problem. The checkout job and the verifier job are both available on the lts-with-plugins branch.

          Mark Waite added a comment - - edited I've verified that the problem is repeatable if an exclusion path is defined in the job and "clean before checkout" is enabled. My test case was: Create a git repository with an ant build script that creates a temporary file as its default target Define a Jenkins job which monitors that repository and runs the ant build script, confirm the workspace has the temporary file after polling Enable "clean before checkout" on that Jenkins job, confirm the workspace has the temporary file after polling Enable path exclusion on the Jenkins job, confirm that the temporary file is deleted from the workspace by the next poll A docker instance now includes a pair of sample jobs which verify this is still a problem. The checkout job and the verifier job are both available on the lts-with-plugins branch.

          Ari Pringle added a comment - - edited

          I've confirmed the same behavior if "Clean before checkout" and "Ignore commits from certain users" are both enabled.

          The workspace is reset every time a poll occurs. If I remove the "Ignore commits from certain users" setting, the workspace is not reset.

          Ari Pringle added a comment - - edited I've confirmed the same behavior if "Clean before checkout" and "Ignore commits from certain users" are both enabled. The workspace is reset every time a poll occurs. If I remove the "Ignore commits from certain users" setting, the workspace is not reset.

          Tim Bradt added a comment -

          We also had the same behavior if "Clean before checkout" and "Polling ignores commits with certain messages" are both enabled. Fortunately there is a workaround that will work for some. Unless the sequence is critical, switching to "Clean after checkout" eliminates the clean during polling.

          Tim Bradt added a comment - We also had the same behavior if "Clean before checkout" and "Polling ignores commits with certain messages" are both enabled. Fortunately there is a workaround that will work for some. Unless the sequence is critical, switching to "Clean after checkout" eliminates the clean during polling.

            Unassigned Unassigned
            rschuetz Ronny Schuetz
            Votes:
            5 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: