diff --git a/vars/dockerExecute.groovy b/vars/dockerExecute.groovy index 725a58f04..30e2d92f9 100644 --- a/vars/dockerExecute.groovy +++ b/vars/dockerExecute.groovy @@ -265,20 +265,20 @@ private getDockerOptions(Map dockerEnvVars, Map dockerVolumeBind, def dockerOpti ] def options = [] if (dockerEnvVars) { - for (String k : dockerEnvVars.keySet()) { - options.add("--env ${k}=${dockerEnvVars[k].toString()}") + dockerEnvVars.each { String k, v -> + options.add("--env ${k}=${v.toString()}") } } - for (String envVar : specialEnvironments) { + specialEnvironments.each { String envVar -> if (dockerEnvVars == null || !dockerEnvVars.containsKey(envVar)) { options.add("--env ${envVar}") } } if (dockerVolumeBind) { - for (String k : dockerVolumeBind.keySet()) { - options.add("--volume ${k}:${dockerVolumeBind[k].toString()}") + dockerVolumeBind.each { String k, v -> + options.add("--volume ${k}:${v.toString()}") } } @@ -287,7 +287,7 @@ private getDockerOptions(Map dockerEnvVars, Map dockerVolumeBind, def dockerOpti dockerOptions = [dockerOptions] } if (dockerOptions instanceof List) { - for (String option : dockerOptions) { + dockerOptions.each { String option -> options << escapeBlanks(option) } } else {