diff --git a/buildSrc/src/main/groovy/com/widen/plugins/UploadPipeline.groovy b/buildSrc/src/main/groovy/com/widen/plugins/UploadPipeline.groovy index 47ce3b9..4537320 100644 --- a/buildSrc/src/main/groovy/com/widen/plugins/UploadPipeline.groovy +++ b/buildSrc/src/main/groovy/com/widen/plugins/UploadPipeline.groovy @@ -14,6 +14,7 @@ class UploadPipeline extends DefaultTask { private static final String DOCKER_PLUGIN_VERSION = 'v1.1.1' private static final String DOCKER_COMPOSE_PLUGIN_VERSION = 'v2.3.0' + private final Map env = [:] private final List steps = [] /** @@ -26,6 +27,20 @@ class UploadPipeline extends DefaultTask { */ boolean replace = false + /** + * Add an environment variable to apply to all steps. + */ + void environment(String name, String value) { + env.put(name, value) + } + + /** + * Add a map of environment variables to apply to all steps. + */ + void environment(Map variables) { + env.putAll(variables) + } + /** * Add a command step to the pipeline. * @@ -75,6 +90,7 @@ class UploadPipeline extends DefaultTask { */ String toJson() { return JsonOutput.toJson([ + env: env, steps: steps ]) }