-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
317 lines (293 loc) · 14.3 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/*
* Copyright (c) 2017-2021 SIL International
* Original file copied from https://github.com/sheehan/job-dsl-gradle-example
* This file is licensed under the Apache License 2.0 (http://www.apache.org/licenses/)
*/
apply plugin: 'groovy'
ext {
jobDslVersion = '1.78.3'
jenkinsVersion = '2.277.1'
}
sourceSets {
jobs {
groovy {
srcDirs 'build/jobs'
compileClasspath += main.compileClasspath
}
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
repositories {
jcenter()
mavenCentral()
maven { url 'https://repo.jenkins-ci.org/releases/' }
maven { url 'https://repo.spring.io/plugins-release' }
maven { url 'https://maven.twttr.com' }
maven { url 'https://repo.eclipse.org/content/groups/releases'}
}
configurations {
testPlugins {}
// see JENKINS-45512
// Exclude buggy Xalan dependency this way the JRE default TransformerFactory is used
// The xalan pulled in by htmlunit does not properly deal with spaces folder / job names
testImplementation {
exclude group: 'xalan'
exclude group: 'xerces'
}
}
dependencies {
implementation 'org.codehaus.groovy:groovy-all:3.0.7'
implementation "org.jenkins-ci.plugins:job-dsl-core:${jobDslVersion}"
implementation 'org.kohsuke:github-api:1.116'
testImplementation 'org.spockframework:spock-core:2.0-M4-groovy-3.0'
// Jenkins test harness dependencies
testImplementation 'org.jenkins-ci.main:jenkins-test-harness:2.68'
testImplementation("org.jenkins-ci.main:jenkins-war:${jenkinsVersion}") {
exclude group: 'org.jenkins-ci.ui', module: 'bootstrap' // https://github.com/sheehan/job-dsl-gradle-example/issues/87
}
// Job DSL plugin including plugin dependencies
testImplementation "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}"
testImplementation "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}@jar"
testImplementation 'org.jenkins-ci.plugins:structs:1.20@jar'
/*
plugins to install in test instance
generate list with this Groovy script in the Jenkins Script Console:
Jenkins.instance.pluginManager.plugins
.findAll { !(it.shortName in ['job-dsl', 'structs']) }
.collect { "\ttestPlugins '${it.manifest.mainAttributes.getValue("Group-Id")}:${it.shortName}:${it.version}'" }
.sort()
.each { println it }
println()
*/
testPlugins 'com.cloudbees.jenkins.plugins:custom-tools-plugin:0.8'
testPlugins 'com.coravy.hudson.plugins.github:github:1.33.1'
testPlugins 'com.sonyericsson.hudson.plugins.gerrit:gerrit-trigger:2.33.0'
testPlugins 'com.sonyericsson.jenkins.plugins.bfa:build-failure-analyzer:2.0.0'
testPlugins 'io.jenkins.blueocean:blueocean-bitbucket-pipeline:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-commons:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-config:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-core-js:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-dashboard:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-events:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-git-pipeline:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-github-pipeline:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-i18n:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-jira:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-jwt:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-personalization:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-pipeline-api-impl:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-pipeline-editor:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-pipeline-scm-api:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-rest-impl:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-rest:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean-web:1.24.5'
testPlugins 'io.jenkins.blueocean:blueocean:1.24.5'
testPlugins 'io.jenkins.blueocean:jenkins-design-language:1.24.5'
testPlugins 'io.jenkins.plugins:analysis-model-api:9.8.1'
testPlugins 'io.jenkins.plugins:aws-global-configuration:1.6'
testPlugins 'io.jenkins.plugins:bootstrap4-api:4.6.0-2'
testPlugins 'io.jenkins.plugins:checks-api:1.6.1'
testPlugins 'io.jenkins.plugins:data-tables-api:1.10.23-3'
testPlugins 'io.jenkins.plugins:echarts-api:5.0.1-1'
testPlugins 'io.jenkins.plugins:font-awesome-api:5.15.2-2'
testPlugins 'io.jenkins.plugins:forensics-api:1.0.0'
testPlugins 'io.jenkins.plugins:jaxb:2.3.0.1'
testPlugins 'io.jenkins.plugins:jjwt-api:0.11.2-9.c8b45b8bb173'
testPlugins 'io.jenkins.plugins:jquery3-api:3.5.1-3'
testPlugins 'io.jenkins.plugins:okhttp-api:3.14.9'
testPlugins 'io.jenkins.plugins:plugin-util-api:2.0.0'
testPlugins 'io.jenkins.plugins:popper-api:1.16.1-2'
testPlugins 'io.jenkins.plugins:snakeyaml-api:1.27.0'
testPlugins 'io.jenkins.plugins:warnings-ng:8.10.1'
testPlugins 'org.6wind.jenkins:lockable-resources:2.10'
testPlugins 'org.jenkins-ci.main:maven-plugin:3.10'
testPlugins 'org.jenkins-ci.plugins.pipeline-stage-view:pipeline-rest-api:2.19'
testPlugins 'org.jenkins-ci.plugins.pipeline-stage-view:pipeline-stage-view:2.19'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-aggregator:2.6'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-api:2.42'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-basic-steps:2.23'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.18'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-cps:2.90'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.38'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-job:2.40'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-multibranch:2.22'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-scm-step:2.12'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.23'
testPlugins 'org.jenkins-ci.plugins.workflow:workflow-support:3.8'
testPlugins 'org.jenkins-ci.plugins:ansicolor:0.7.5'
testPlugins 'org.jenkins-ci.plugins:ant:1.11'
testPlugins 'org.jenkins-ci.plugins:antisamy-markup-formatter:2.1'
testPlugins 'org.jenkins-ci.plugins:apache-httpcomponents-client-4-api:4.5.13-1.0'
testPlugins 'org.jenkins-ci.plugins:authentication-tokens:1.4'
testPlugins 'org.jenkins-ci.plugins:aws-credentials:1.28.1'
testPlugins 'org.jenkins-ci.plugins:aws-java-sdk:1.11.976'
testPlugins 'org.jenkins-ci.plugins:blueocean-autofavorite:1.2.4'
testPlugins 'org.jenkins-ci.plugins:blueocean-display-url:2.4.1'
testPlugins 'org.jenkins-ci.plugins:bouncycastle-api:2.20'
testPlugins 'org.jenkins-ci.plugins:branch-api:2.6.3'
testPlugins 'org.jenkins-ci.plugins:build-pipeline-plugin:1.5.8'
testPlugins 'org.jenkins-ci.plugins:build-timeout:1.20'
testPlugins 'org.jenkins-ci.plugins:build-token-root:1.7'
testPlugins 'org.jenkins-ci.plugins:buildtriggerbadge:2.10'
testPlugins 'org.jenkins-ci.plugins:built-on-column:1.1'
testPlugins 'org.jenkins-ci.plugins:categorized-view:1.11'
testPlugins 'org.jenkins-ci.plugins:claim:2.18.2'
testPlugins 'org.jenkins-ci.plugins:cloudbees-bitbucket-branch-source:2.9.7'
testPlugins 'org.jenkins-ci.plugins:cloudbees-folder:6.15'
testPlugins 'org.jenkins-ci.plugins:command-launcher:1.5'
testPlugins 'org.jenkins-ci.plugins:conditional-buildstep:1.4.1'
testPlugins 'org.jenkins-ci.plugins:config-file-provider:3.7.0'
testPlugins 'org.jenkins-ci.plugins:copyartifact:1.46'
testPlugins 'org.jenkins-ci.plugins:credentials-binding:1.24'
testPlugins 'org.jenkins-ci.plugins:credentials:2.3.15'
testPlugins 'org.jenkins-ci.plugins:dashboard-view:2.15'
testPlugins 'org.jenkins-ci.plugins:description-setter:1.10'
testPlugins 'org.jenkins-ci.plugins:disable-github-multibranch-status:1.2'
testPlugins 'org.jenkins-ci.plugins:disk-usage:0.28'
testPlugins 'org.jenkins-ci.plugins:display-url-api:2.3.4'
testPlugins 'org.jenkins-ci.plugins:docker-commons:1.17'
testPlugins 'org.jenkins-ci.plugins:docker-workflow:1.26'
testPlugins 'org.jenkins-ci.plugins:dtkit-api:3.0.0'
testPlugins 'org.jenkins-ci.plugins:durable-task:1.35'
testPlugins 'org.jenkins-ci.plugins:email-ext:2.82'
testPlugins 'org.jenkins-ci.plugins:envinject-api:1.7'
testPlugins 'org.jenkins-ci.plugins:envinject:2.4.0'
testPlugins 'org.jenkins-ci.plugins:extended-choice-parameter:0.82'
testPlugins 'org.jenkins-ci.plugins:external-monitor-job:1.7'
testPlugins 'org.jenkins-ci.plugins:extra-columns:1.22'
testPlugins 'org.jenkins-ci.plugins:flexible-publish:0.16.1'
testPlugins 'org.jenkins-ci.plugins:generic-webhook-trigger:1.72'
testPlugins 'org.jenkins-ci.plugins:ghprb:1.42.2'
testPlugins 'org.jenkins-ci.plugins:git-client:3.7.0'
testPlugins 'org.jenkins-ci.plugins:git-server:1.9'
testPlugins 'org.jenkins-ci.plugins:git:4.7.0'
testPlugins 'org.jenkins-ci.plugins:github-api:1.123'
testPlugins 'org.jenkins-ci.plugins:github-branch-source:2.10.2'
testPlugins 'org.jenkins-ci.plugins:gradle:1.36'
testPlugins 'org.jenkins-ci.plugins:groovy:2.3'
testPlugins 'org.jenkins-ci.plugins:handy-uri-templates-2-api:2.1.8-1.0'
testPlugins 'org.jenkins-ci.plugins:htmlpublisher:1.25'
testPlugins 'org.jenkins-ci.plugins:jackson2-api:2.12.1'
testPlugins 'org.jenkins-ci.plugins:javadoc:1.6'
testPlugins 'org.jenkins-ci.plugins:jdk-tool:1.5'
testPlugins 'org.jenkins-ci.plugins:jira:3.2'
testPlugins 'org.jenkins-ci.plugins:jobConfigHistory:2.26'
testPlugins 'org.jenkins-ci.plugins:jquery:1.12.4-1'
testPlugins 'org.jenkins-ci.plugins:jsch:0.1.55.2'
testPlugins 'org.jenkins-ci.plugins:junit:1.49'
testPlugins 'org.jenkins-ci.plugins:ldap:2.4'
testPlugins 'org.jenkins-ci.plugins:mailer:1.33'
testPlugins 'org.jenkins-ci.plugins:matrix-auth:2.6.6'
testPlugins 'org.jenkins-ci.plugins:matrix-project:1.18'
testPlugins 'org.jenkins-ci.plugins:mercurial:2.14'
testPlugins 'org.jenkins-ci.plugins:msbuild:1.30'
testPlugins 'org.jenkins-ci.plugins:multiple-scms:0.6'
testPlugins 'org.jenkins-ci.plugins:naginator:1.18.1'
testPlugins 'org.jenkins-ci.plugins:nested-view:1.17'
testPlugins 'org.jenkins-ci.plugins:nodenamecolumn:1.2'
testPlugins 'org.jenkins-ci.plugins:nunit:0.27'
testPlugins 'org.jenkins-ci.plugins:pam-auth:1.6'
testPlugins 'org.jenkins-ci.plugins:parameterized-trigger:2.40'
testPlugins 'org.jenkins-ci.plugins:periodic-reincarnation:1.13'
testPlugins 'org.jenkins-ci.plugins:pipeline-build-step:2.13'
testPlugins 'org.jenkins-ci.plugins:pipeline-github:2.7'
testPlugins 'org.jenkins-ci.plugins:pipeline-graph-analysis:1.10'
testPlugins 'org.jenkins-ci.plugins:pipeline-input-step:2.12'
testPlugins 'org.jenkins-ci.plugins:pipeline-milestone-step:1.3.2'
testPlugins 'org.jenkins-ci.plugins:pipeline-stage-step:2.5'
testPlugins 'org.jenkins-ci.plugins:plain-credentials:1.7'
testPlugins 'org.jenkins-ci.plugins:plugin-usage-plugin:1.2'
testPlugins 'org.jenkins-ci.plugins:publish-over:0.22'
testPlugins 'org.jenkins-ci.plugins:pubsub-light:1.13'
testPlugins 'org.jenkins-ci.plugins:role-strategy:3.1.1'
testPlugins 'org.jenkins-ci.plugins:run-condition:1.5'
testPlugins 'org.jenkins-ci.plugins:s3:0.11.6'
testPlugins 'org.jenkins-ci.plugins:saferestart:0.3'
testPlugins 'org.jenkins-ci.plugins:scm-api:2.6.4'
testPlugins 'org.jenkins-ci.plugins:script-security:1.76'
testPlugins 'org.jenkins-ci.plugins:slack:2.46'
testPlugins 'org.jenkins-ci.plugins:sse-gateway:1.24'
testPlugins 'org.jenkins-ci.plugins:ssh-agent:1.21'
testPlugins 'org.jenkins-ci.plugins:ssh-credentials:1.18.1'
testPlugins 'org.jenkins-ci.plugins:ssh-slaves:1.31.5'
testPlugins 'org.jenkins-ci.plugins:text-finder:1.15'
testPlugins 'org.jenkins-ci.plugins:throttle-concurrents:2.2'
testPlugins 'org.jenkins-ci.plugins:timestamper:1.12'
testPlugins 'org.jenkins-ci.plugins:token-macro:2.15'
testPlugins 'org.jenkins-ci.plugins:trilead-api:1.0.13'
testPlugins 'org.jenkins-ci.plugins:variant:1.4'
testPlugins 'org.jenkins-ci.plugins:versioncolumn:2.1'
testPlugins 'org.jenkins-ci.plugins:view-job-filters:2.3'
testPlugins 'org.jenkins-ci.plugins:windows-slaves:1.7'
testPlugins 'org.jenkins-ci.plugins:xunit:2.4.0'
testPlugins 'org.jenkins-ci.plugins:xvfb:1.1.3'
testPlugins 'org.jenkins-ci.ui:ace-editor:1.1'
testPlugins 'org.jenkins-ci.ui:handlebars:1.1.1'
testPlugins 'org.jenkins-ci.ui:jquery-detached:1.2.1'
testPlugins 'org.jenkins-ci.ui:momentjs:1.1.1'
testPlugins 'org.jenkinsci.plugins:managed-scripts:1.5.4'
testPlugins 'org.jenkinsci.plugins:pipeline-model-api:1.8.4'
testPlugins 'org.jenkinsci.plugins:pipeline-model-definition:1.8.4'
testPlugins 'org.jenkinsci.plugins:pipeline-model-extensions:1.8.4'
testPlugins 'org.jenkinsci.plugins:pipeline-stage-tags-metadata:1.8.4'
testPlugins 'org.jvnet.hudson.plugins:extended-read-permission:3.2'
testPlugins 'org.jvnet.hudson.plugins:favorite:2.3.3'
// for the RestApiScriptRunner
implementation('org.codehaus.groovy.modules.http-builder:http-builder:0.7.2') {
exclude(module: 'groovy')
}
// for the RestApiScriptRunner
implementation('org.apache.ant:ant:1.10.7')
}
task resolveTestPlugins(type: Copy) {
from configurations.testPlugins
into new File(sourceSets.test.output.resourcesDir, 'test-dependencies')
include '*.hpi'
include '*.jpi'
def renames = [:]
doFirst {
configurations.testPlugins.resolvedConfiguration.resolvedArtifacts.unique(false, {
a, b -> a.name <=> b.name
}).each {
renames[it.file.name] = "${it.name}.${it.extension}"
}
}
rename { renames[it] }
doLast {
def mapping = [:]
configurations.testPlugins.resolvedConfiguration.resolvedArtifacts.each {
mapping[it.file.name] = "${it.name}.${it.extension}"
}
List<String> baseNames = source*.name.collect { mapping[it] }.collect { it[0..it.lastIndexOf('.') - 1] }
new File(destinationDir, 'index').setText(baseNames.join('\n'), 'UTF-8')
}
}
// Allow including of common scripts
// To include a file add a line '//#include path/to/file.ext'
// File location is relative to the source file
task preprocess(type: Copy) {
from 'groovy'
include '*.groovy'
into 'build/jobs'
filter { String line ->
def includeToken = '//#include '
if (line.trim().startsWith(includeToken)) {
def includeFile = line.trim().substring(includeToken.length())
return new File("groovy/$includeFile").text
}
return line
}
}
test {
dependsOn tasks.preprocess, tasks.resolveTestPlugins
inputs.files sourceSets.jobs.groovy.srcDirs
project.logger.lifecycle("Testing with Jenkins ${jenkinsVersion}, Job DSL ${jobDslVersion}")
// set build directory for Jenkins test harness, JENKINS-26331
systemProperty 'buildDirectory', project.buildDir.absolutePath
}
task rest(dependsOn: 'classes', type: JavaExec) {
main = 'com.dslexample.rest.RestApiScriptRunner'
classpath = sourceSets.main.runtimeClasspath
systemProperties System.getProperties()
}