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

add a cross platform step that will delete all files in the current directory.

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline
    • None

      As a user I want to be able to have a clean workspace (or subset of a workspace).

      I do not want to fall back to writing scripts with `if (unix) else windows {}` which could also be problematic as the control file lives in these directories and there would also be no way to delete the current directory

          [JENKINS-30346] add a cross platform step that will delete all files in the current directory.

          Will this fix address this problem: JENKINS-28382 ?
          The fact that I cannot easily delete a workspace has been the biggest blocker for me using the workspace plugin.

          Craig Rodrigues added a comment - Will this fix address this problem: JENKINS-28382 ? The fact that I cannot easily delete a workspace has been the biggest blocker for me using the workspace plugin.

          James Nord added a comment -

          This will allow you to clean a workspace from within the workflow script. Out will not help with showing any actions.

          James Nord added a comment - This will allow you to clean a workspace from within the workflow script. Out will not help with showing any actions.

          Jesse Glick added a comment -

          Right, JENKINS-26138 is a distinct issue, though one common use case for wanting to manually Wipe Workspace on occasion (to fix “sticky” build failures) is better handled by either using the new step, or (preferably) selecting the option in your SCM plugin to clean unversioned files (e.g., git clean -fdx equivalent).

          Jesse Glick added a comment - Right, JENKINS-26138 is a distinct issue, though one common use case for wanting to manually Wipe Workspace on occasion (to fix “sticky” build failures) is better handled by either using the new step, or (preferably) selecting the option in your SCM plugin to clean unversioned files (e.g., git clean -fdx equivalent).

          Code changed in jenkins
          User: James Nord
          Path:
          CHANGES.md
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStepTest.java
          basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStep.java
          basic-steps/src/main/resources/org/jenkinsci/plugins/workflow/steps/DeleteDirStep/config.jelly
          http://jenkins-ci.org/commit/workflow-plugin/18812f0360697345fd2065ea769a86dcdd10b08c
          Log:
          [FIXED JENKINS-30346] Added a deleteDirStep to wipe out a directory

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStepTest.java basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStep.java basic-steps/src/main/resources/org/jenkinsci/plugins/workflow/steps/DeleteDirStep/config.jelly http://jenkins-ci.org/commit/workflow-plugin/18812f0360697345fd2065ea769a86dcdd10b08c Log: [FIXED JENKINS-30346] Added a deleteDirStep to wipe out a directory

          Code changed in jenkins
          User: James Nord
          Path:
          CHANGES.md
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStepTest.java
          basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStep.java
          basic-steps/src/main/resources/org/jenkinsci/plugins/workflow/steps/DeleteDirStep/config.jelly
          basic-steps/src/main/resources/org/jenkinsci/plugins/workflow/steps/DeleteDirStep/help.html
          http://jenkins-ci.org/commit/workflow-plugin/aa620904ac26985b5a28cd3c836d734a36f382ca
          Log:
          Merge pull request #204 from jtnord/JENKINS-30346

          [FIXED JENKINS-30346] Added a deleteDirStep to wipe out a directory

          Compare: https://github.com/jenkinsci/workflow-plugin/compare/0d3a4fd8aa9b...aa620904ac26

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStepTest.java basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStep.java basic-steps/src/main/resources/org/jenkinsci/plugins/workflow/steps/DeleteDirStep/config.jelly basic-steps/src/main/resources/org/jenkinsci/plugins/workflow/steps/DeleteDirStep/help.html http://jenkins-ci.org/commit/workflow-plugin/aa620904ac26985b5a28cd3c836d734a36f382ca Log: Merge pull request #204 from jtnord/ JENKINS-30346 [FIXED JENKINS-30346] Added a deleteDirStep to wipe out a directory Compare: https://github.com/jenkinsci/workflow-plugin/compare/0d3a4fd8aa9b...aa620904ac26

          This does not address JENKINS-26138, but it is a closer step to solving it.

          Can I use a parameterized build, along with your change to the workflow plugin to do the following:

          (1) I have a workflow.
          (2) With the workflow, I have a build parameter, "do_clean" which by default is set to 0.
          (3) If "do_clean" is set to 1, then logic in the workflow will be triggered which cleans out the files,
          otherwise if "do_clean" is set to 0, then no cleaning occurs.

          If this is possible, could you post a code snippet of a workflow which does this?

          Thanks.

          Craig Rodrigues added a comment - This does not address JENKINS-26138 , but it is a closer step to solving it. Can I use a parameterized build, along with your change to the workflow plugin to do the following: (1) I have a workflow. (2) With the workflow, I have a build parameter, "do_clean" which by default is set to 0. (3) If "do_clean" is set to 1, then logic in the workflow will be triggered which cleans out the files, otherwise if "do_clean" is set to 0, then no cleaning occurs. If this is possible, could you post a code snippet of a workflow which does this? Thanks.

          Jesse Glick added a comment -

          Sure you could use a boolean parameter for that purpose. Best to ask in user forums (user list, StackOverflow) for help though.

          Jesse Glick added a comment - Sure you could use a boolean parameter for that purpose. Best to ask in user forums (user list, StackOverflow) for help though.

          Craig Rodrigues added a comment - OK, I asked here: https://groups.google.com/forum/#!topic/jenkinsci-users/XqCz4pyp6_g

          Code changed in jenkins
          User: James Nord
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStepTest.java
          basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStep.java
          basic-steps/src/main/resources/org/jenkinsci/plugins/workflow/steps/DeleteDirStep/config.jelly
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/bf493b14ac8e814fe5bbad9bd6af205eeba953ae
          Log:
          [FIXED JENKINS-30346] Added a deleteDirStep to wipe out a directory

          Originally-Committed-As: 18812f0360697345fd2065ea769a86dcdd10b08c

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStepTest.java basic-steps/src/main/java/org/jenkinsci/plugins/workflow/steps/DeleteDirStep.java basic-steps/src/main/resources/org/jenkinsci/plugins/workflow/steps/DeleteDirStep/config.jelly http://jenkins-ci.org/commit/workflow-basic-steps-plugin/bf493b14ac8e814fe5bbad9bd6af205eeba953ae Log: [FIXED JENKINS-30346] Added a deleteDirStep to wipe out a directory Originally-Committed-As: 18812f0360697345fd2065ea769a86dcdd10b08c

            Unassigned Unassigned
            teilo James Nord
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: