I have a Jenkins pipeline looking like this
stage 'build app'
build 'app-build'
stash 'app-stash'
stage 'build container'
unstash 'app-stash'
build 'container-build'
The builds app-build
and container-build
obtain new nodes from our Kubernetes system.
With stash I want to transfer the artifacts from app-build
to container-build
.
However when running this pipeline the following error occurs:
[Pipeline] stash
Required context class hudson.FilePath is missing
Perhaps you forgot to surround the code with a step that provides this, such as: node
[Pipeline] End of Pipeline
org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing
at org.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:254)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:179)
I don't want to use node
in my pipeline since I only have one executor on my nodes.
Is it possible to use stash
without the node
directive?