dockerExecuteOnKubernetes: fix stash overriding (#329)

* dockerExecuteOnKubernetes: fix stash overriding

* update comment
This commit is contained in:
Christopher Fenner
2018-10-05 10:51:01 +02:00
committed by GitHub
parent d4ca181b1d
commit f10a8c6246
+4 -7
View File
@@ -84,9 +84,9 @@ void executeOnPodWithSingleContainer(Map parameters, body) {
- The container method
- The body
* We use nested exception handling in this case.
* In the first 2 cases, the workspace has not been modified. Hence, we can stash existing workspace as container and
* unstash in the finally block. In case of exception thrown by the body, we need to stash the workspace from the container
* in finally block
* In the first 2 cases, the 'container' stash is not created because the inner try/finally is not reached.
* However, the workspace has not been modified and don't need to be restored.
* In case third case, we need to create the 'container' stash to bring the modified content back to the host.
*/
try {
stashWorkspace(config, 'workspace')
@@ -98,13 +98,10 @@ void executeOnPodWithSingleContainer(Map parameters, body) {
body()
} finally {
stashWorkspace(config, 'container')
}
}
}
}
}
} catch (e) {
stashWorkspace(config, 'container')
throw e
} finally {
unstashWorkspace(config, 'container')
}