The stash step fails if there's no files are selected to be stashed. Allowing that to optionally work would make it easier to make Jenkinsfile more generic, by stashing files that might not get generated on some repositories, instead of passing information around with fields, or catching failure when unstashing (which still leaves the corresponding log marked as Failure in the build).

          [JENKINS-37327] Allow stashing/unstashing empty sets

          Max Wahler added a comment -

          Moreover, stash doesn't include empty directories that might be used after an unstash.

          Max Wahler added a comment - Moreover, stash doesn't include empty directories that might be used after an unstash .

          Code changed in jenkins
          User: Iain Adams
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/flow/StashManager.java
          http://jenkins-ci.org/commit/workflow-api-plugin/9e3a0d00ce97280a906018a82a5b1cf3b745f62c
          Log:
          JENKINS-37327 allow empty stash.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Iain Adams Path: src/main/java/org/jenkinsci/plugins/workflow/flow/StashManager.java http://jenkins-ci.org/commit/workflow-api-plugin/9e3a0d00ce97280a906018a82a5b1cf3b745f62c Log: JENKINS-37327 allow empty stash.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/flow/StashManager.java
          http://jenkins-ci.org/commit/workflow-api-plugin/b19922c71d411c3d0032862dee3a971cc03d36f0
          Log:
          Merge pull request #35 from iwarapter/master

          JENKINS-37327 allow empty stash.

          Compare: https://github.com/jenkinsci/workflow-api-plugin/compare/8c74d216226c...b19922c71d41

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/flow/StashManager.java http://jenkins-ci.org/commit/workflow-api-plugin/b19922c71d411c3d0032862dee3a971cc03d36f0 Log: Merge pull request #35 from iwarapter/master JENKINS-37327 allow empty stash. Compare: https://github.com/jenkinsci/workflow-api-plugin/compare/8c74d216226c...b19922c71d41

          Code changed in jenkins
          User: Iain Adams
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep.java
          src/main/resources/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep/config.jelly
          src/test/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashTest.java
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/9b2d10a70074d4768047f7c63a8b555a883e81d7
          Log:
          JENKINS-37327 allow empty stash.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Iain Adams Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep.java src/main/resources/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep/config.jelly src/test/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashTest.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/9b2d10a70074d4768047f7c63a8b555a883e81d7 Log: JENKINS-37327 allow empty stash.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep.java
          src/main/resources/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep/config.jelly
          src/test/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashTest.java
          http://jenkins-ci.org/commit/workflow-basic-steps-plugin/e4266ac53595cb31f22df8c3d53fa781d8e108f1
          Log:
          Merge pull request #42 from iwarapter/master

          JENKINS-37327 allow empty stash.

          Compare: https://github.com/jenkinsci/workflow-basic-steps-plugin/compare/37d4589bc6bb...e4266ac53595

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep.java src/main/resources/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep/config.jelly src/test/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashTest.java http://jenkins-ci.org/commit/workflow-basic-steps-plugin/e4266ac53595cb31f22df8c3d53fa781d8e108f1 Log: Merge pull request #42 from iwarapter/master JENKINS-37327 allow empty stash. Compare: https://github.com/jenkinsci/workflow-basic-steps-plugin/compare/37d4589bc6bb...e4266ac53595

            Unassigned Unassigned
            dcsobral Daniel Sobral
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: