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

Request preservation of git repository during cleanWs()

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: ws-cleanup-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.242
    • Similar Issues:

      Description

      This is actually for the Workspace Cleanup Plugin (not listed in Components).

      Request the ability to preserve the .git repository clone within a workspace when cleanWs() or an analogue is run within a pipeline. The need to run cleanWs came from our sysadmin because of heavy inode usage in multiple builds instead of disk free space needs. It takes over 2 hours to perform a clone from scratch, so we would like something that keeps the .git directory around. An exclusion pattern might be useful, like cleanButNot(['.git',...]).

        Attachments

          Activity

          Hide
          rsbeckerca Randall Becker added a comment -

          I tried a similar approach with the same effect, using find and -exec rm leaving git, but that caused Jenkins to become very upset that the workspace had disappeared (I don't recall the error). cleanWs() seems aware explicitly that the workspace is being removed and avoids confusing Jenkins.

          Show
          rsbeckerca Randall Becker added a comment - I tried a similar approach with the same effect, using find and -exec rm leaving git, but that caused Jenkins to become very upset that the workspace had disappeared (I don't recall the error). cleanWs() seems aware explicitly that the workspace is being removed and avoids confusing Jenkins.
          Hide
          markewaite Mark Waite added a comment -

          You could consider calling sh 'git clean -xffd' as a way to clean the workspace of all untracked files.

          Show
          markewaite Mark Waite added a comment - You could consider calling sh 'git clean -xffd' as a way to clean the workspace of all untracked files.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rsbeckerca Randall Becker
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: