diff --git a/vars/buildContainerImage2.groovy b/vars/buildContainerImage2.groovy index e67c509..71c8a03 100644 --- a/vars/buildContainerImage2.groovy +++ b/vars/buildContainerImage2.groovy @@ -116,11 +116,10 @@ def runInPod(args, block) { def podTemplateYaml = libraryResource('podTemplate2.yaml') if (resources) { def tmpl = readYaml(text: podTemplateYaml) - tmpl.spec.containers.each { - it.resources = [ - requests: resources, - limits: resources, - ] + tmpl.spec.containers.each { c -> + c.resources = c.resources ?: [requests: [:], limits: [:]] + c.resources.requests += resources + c.resources.limits += resources } podTemplateYaml = writeYaml(data: tmpl, returnText: true) echo podTemplateYaml