diff --git a/.buildkite/pipeline.extra.gradle b/.buildkite/pipeline.extra.gradle new file mode 100644 index 0000000..bfea80a --- /dev/null +++ b/.buildkite/pipeline.extra.gradle @@ -0,0 +1,5 @@ +buildkite.pipeline('extra') { + environment { + FOO = 'extra' + } +} diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml deleted file mode 100644 index 4e37e8f..0000000 --- a/.buildkite/pipeline.yml +++ /dev/null @@ -1,8 +0,0 @@ -steps: - - label: ":pipeline:" - command: "./gradlew uploadPipeline" - agents: - queue: builder - plugins: - docker-compose#v3.0.3: - run: gradle diff --git a/build.gradle b/build.gradle index e510b5b..52c8602 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/buildSrc/src/main/groovy/com/widen/plugins/buildkite/BuildkitePlugin.groovy b/buildSrc/src/main/groovy/com/widen/plugins/buildkite/BuildkitePlugin.groovy index fa43362..a1e1a24 100644 --- a/buildSrc/src/main/groovy/com/widen/plugins/buildkite/BuildkitePlugin.groovy +++ b/buildSrc/src/main/groovy/com/widen/plugins/buildkite/BuildkitePlugin.groovy @@ -22,7 +22,16 @@ class BuildkitePlugin implements Plugin { } } + // 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" @@ -45,6 +54,11 @@ class BuildkitePlugin implements Plugin { protected final Map> 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. */