Skip to content

Commit

Permalink
Add ability to set pipeline-wide variables
Browse files Browse the repository at this point in the history
  • Loading branch information
sagebind committed Apr 3, 2019
1 parent 850193b commit 4dc2edd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions buildSrc/src/main/groovy/com/widen/plugins/UploadPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> env = [:]
private final List steps = []

/**
Expand All @@ -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<String, String> variables) {
env.putAll(variables)
}

/**
* Add a <a href="https://buildkite.com/docs/pipelines/command-step">command step</a> to the pipeline.
*
Expand Down Expand Up @@ -75,6 +90,7 @@ class UploadPipeline extends DefaultTask {
*/
String toJson() {
return JsonOutput.toJson([
env: env,
steps: steps
])
}
Expand Down

0 comments on commit 4dc2edd

Please sign in to comment.