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

Delete existing stash in a pipeline

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      After creating a stash, and using it, would need to be able to delete it before the end of the pipeline to free some resources, typically before waiting for user input:

      // code placeholder
      node {
        git checkout
        stash name: "source"
        
        parallel (
         task1: {
           node {
             unstash name: "sources"
             sh "make DEBUG=1"
           }
         },
      
         task2: {
           node {
             unstash name: "sources"
             sh "make DEBUG=0"
           }
         })
      
         deleteStash name: "sources"  // New feature: free disk space before the end of pipeline
         
         input message: "Go ?"
      }
      

        Attachments

          Activity

          Hide
          jguigui Jean-Paul G added a comment -

          A workaround I'm using is to create an empty stash with same name:

          stash name: "sources", excludes: "**", allowEmpty: true
          
          Show
          jguigui Jean-Paul G added a comment - A workaround I'm using is to create an empty stash with same name: stash name: "sources" , excludes: "**" , allowEmpty: true
          Hide
          abayer Andrew Bayer added a comment -

          That's probably the best workaround for now. The stashes will be deleted when the build completes, but yeah, there is no mechanism at this point for deleting a stash mid-build.

          Show
          abayer Andrew Bayer added a comment - That's probably the best workaround for now. The stashes will be deleted when the build completes, but yeah, there is no mechanism at this point for deleting a stash mid-build.

            People

            • Assignee:
              Unassigned
              Reporter:
              jguigui Jean-Paul G
            • Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated: