diff --git a/buildSrc/src/main/groovy/com/widen/plugins/buildkite/ConfigurableEnvironment.groovy b/buildSrc/src/main/groovy/com/widen/plugins/buildkite/ConfigurableEnvironment.groovy index 240e063..dc9b996 100644 --- a/buildSrc/src/main/groovy/com/widen/plugins/buildkite/ConfigurableEnvironment.groovy +++ b/buildSrc/src/main/groovy/com/widen/plugins/buildkite/ConfigurableEnvironment.groovy @@ -22,9 +22,11 @@ trait ConfigurableEnvironment { * Set environment variables using a configure block. */ void environment(@DelegatesTo(Map) Closure closure) { - [:].with { - with(closure) - environment(it) - } + def map = [:] + closure = (Closure) closure.clone() + closure.delegate = map + closure.resolveStrategy = Closure.OWNER_FIRST + closure() + environment(map) } }