Skip to content

Commit

Permalink
Allow setting multiple passthrough variables at once
Browse files Browse the repository at this point in the history
Improve Docker and Docker Compose DSLs when setting more than one variable to pass through from the pipeline.
  • Loading branch information
sagebind committed Feb 28, 2020
1 parent 1f4e2e4 commit 363095f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .buildkite/pipeline.extra-steps.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ commandStep {
// Common Buildkite plugins are also part of the DSL.
dockerCompose {
run 'unit'
// Passthrough variables
environment(
'FOO',
'BAR',
'BAZ',
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ class BuildkitePipeline implements ConfigurableEnvironment {
}

/**
* Set an environment variable to pass into the Docker container.
* Set one or more environment variables to pass into the Docker container.
*
* @param name The variable name.
* @param name The variable names.
*/
void environment(String name) {
model.get('environment', []) << name
void environment(String... names) {
model.get('environment', []).addAll(names)
}

/**
Expand Down Expand Up @@ -383,10 +383,12 @@ class BuildkitePipeline implements ConfigurableEnvironment {
}

/**
* Set an environment variable to pass into the container.
* Set one or more environment variables to pass into the Docker container.
*
* @param name The variable names.
*/
void environment(String name) {
model.get('env', []) << name
void environment(String... names) {
model.get('env', []).addAll(names)
}

/**
Expand Down

0 comments on commit 363095f

Please sign in to comment.