-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
130 lines (105 loc) · 3.57 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import com.widen.plugins.buildkite.BuildkitePlugin
plugins {
id 'groovy'
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.11.0'
id 'com.widen.versioning' version '0.4.1'
}
apply plugin: BuildkitePlugin
group = 'com.widen'
dependencies {
compile gradleApi()
compile localGroovy()
}
javadoc {
source 'buildSrc/src/main/java'
}
groovydoc {
source 'buildSrc/src/main/groovy'
}
jar {
from "${rootProject.rootDir}/buildSrc/build/classes/groovy/main"
from("${rootProject.rootDir}/buildSrc/src/main/groovy") {
include '**/*.gdsl'
}
}
System.setProperty("gradle.publish.key", System.getenv("GRADLE_PUBLISH_KEY") ?: "")
System.setProperty("gradle.publish.secret", System.getenv("GRADLE_PUBLISH_SECRET") ?: "")
gradlePlugin {
plugins {
buildkitePlugin {
id = 'com.widen.buildkite'
implementationClass = BuildkitePlugin.name
}
}
}
pluginBundle {
website = 'https://github.com/Widen/buildkite-gradle-plugin'
vcsUrl = 'https://github.com/Widen/buildkite-gradle-plugin'
description = 'A Gradle plugin that provides a DSL for dynamically generating Buildkite pipelines.'
tags = ['buildkite']
plugins {
buildkitePlugin {
id = 'com.widen.buildkite'
displayName = 'Widen Buildkite Gradle plugin'
}
}
}
// This serves as a live example of how to use the plugin.
buildkite {
// Configure the "default" pipeline.
pipeline {
replace = true
// Add a command step that invokes another Gradle task.
commandStep {
// Most methods mirror the names used in a Buildkite YAML file.
label ':junit: Unit tests'
artifactPath 'src/build/reports/integTest/**/*'
// Specify which Buildkite agents should pick up this work.
agentQueue 'builder'
// Environment variables can be set in multiple ways.
environment 'FOO', 'a'
environment BAR: 42, BAZ: 43
environment {
HELLO = 'world'
}
plugin 'Widen/gradle#v1', {
tasks 'check'
systemProperties "com.widen.plugins.buildkite.foo": "bar"
foo = [
{
bar = 2
}
]
}
}
commandStep {
label ':boom: Soft fail step'
command 'soft-fail.sh'
softFail(1, 127)
}
waitStep()
commandStep {
label ':gradle: Publish plugin'
branches '*.*.*'
// Custom plugins can also be used by name.
plugin 'Widen/gradle#v1', {
tasks 'publishPlugins'
}
}
// You can also set environment variables that apply to the whole pipeline.
environment {
FOO = 'bar'
}
}
// You can also add additional pipelines with a name other than the default.
pipeline 'secondary', {}
// The default agent queue for steps that do not specify one is "builder", but this can be changed here.
defaultAgentQueue 'builder'
// 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 by default.
pluginVersion 'docker-compose', 'v3.0.3'
}