From a011c67d09fcfd37ebf27190ba55949216077b37 Mon Sep 17 00:00:00 2001 From: Marcus Holl Date: Wed, 3 Apr 2019 13:31:07 +0200 Subject: [PATCH] No update to the stash content list from dockerExecuteOnK8S When dealing with stashes in dockerExecuteOnKubernetes the global stash list was updated from the step. This resulted in stashes transported between the steps, which in turn resulted in having old stashes unstashed in a pod later down the build. E.g.: mtaBuild followed by neoDeploy: mtaBuild created a stash, the stash was rememebered in the default stash list and re-used later on by neoDeploy. Since the stash was created before the mtaBuild the deployable was missing in the step. --- vars/dockerExecuteOnKubernetes.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vars/dockerExecuteOnKubernetes.groovy b/vars/dockerExecuteOnKubernetes.groovy index 5da2b1e6a..86e1cb393 100644 --- a/vars/dockerExecuteOnKubernetes.groovy +++ b/vars/dockerExecuteOnKubernetes.groovy @@ -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)