Skip to content

Commit

Permalink
Include external scripts by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sagebind committed Jul 3, 2019
1 parent 8d32505 commit 9f2a700
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .buildkite/pipeline.extra.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
buildkite.pipeline('extra') {
environment {
FOO = 'extra'
}
}
8 changes: 0 additions & 8 deletions .buildkite/pipeline.yml

This file was deleted.

7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ buildkite {
}
}

// You can also add additional pipelines with a name other than the default.
pipeline 'secondary', {}

// You can also define pipelines in external script files inside your .buildkite directory matching the pattern 'buildkite*.gradle' and they will be
// included automatically. This is true by default.
includeScripts = true

// There are also a few other things we can do besides define pipelines. Like set which versions of Buildkite
// plugins we want to use.
pluginVersion 'docker-compose', 'v3.0.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ class BuildkitePlugin implements Plugin<Project> {
}
}

// Run anything that needs to be done after plugin configuration has been evaluated.
project.afterEvaluate {
if (extension.includeScripts) {
project.fileTree(project.rootDir) {
include '.buildkite/pipeline*.gradle'
}.each {
project.apply from: it
}
}

extension.pipelines.each { name, config ->
def taskName = name == 'default' ? 'uploadPipeline' : "upload${name}Pipeline"

Expand All @@ -45,6 +54,11 @@ class BuildkitePlugin implements Plugin<Project> {
protected final Map<String, Closure<BuildkitePipeline>> pipelines = [:]
protected Config config

/**
* Whether detected pipeline script files should be included automatically.
*/
boolean includeScripts = true

/**
* Specify the version of a Buildkite plugin that should be used inside pipelines if no version is specified.
*/
Expand Down

0 comments on commit 9f2a700

Please sign in to comment.