1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

Merge pull request #632 from marcusholl/pr/noCachedWorkspaceStashes

Avoid phantom stashes: do not write stashes back into (default) config
This commit is contained in:
Marcus Holl 2019-04-12 17:41:51 +02:00 committed by GitHub
commit 4af3a2a861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,8 +162,10 @@ void executeOnPod(Map config, utils, Closure body) {
* In case third case, we need to create the 'container' stash to bring the modified content back to the host.
*/
try {
if (config.containerName && config.stashContent.isEmpty()){
config.stashContent.add(stashWorkspace(config, 'workspace'))
def stashContent = config.stashContent
if (config.containerName && stashContent.isEmpty()){
stashContent = [stashWorkspace(config, 'workspace')]
}
podTemplate(getOptions(config)) {
node(config.uniqueId) {
@ -175,7 +177,7 @@ void executeOnPod(Map config, utils, Closure body) {
echo "ContainerConfig: ${containerParams}"
container(containerParams){
try {
utils.unstashAll(config.stashContent)
utils.unstashAll(stashContent)
body()
} finally {
stashWorkspace(config, 'container', true)