• Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins 2.113

      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 ?"
      }
      

          [JENKINS-50526] Delete existing stash in a pipeline

          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
          

          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

          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.

          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.

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

              Created:
              Updated: