-
Notifications
You must be signed in to change notification settings - Fork 8
/
pipeline-nested-view.dsl
79 lines (68 loc) · 1.69 KB
/
pipeline-nested-view.dsl
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
def slurper = new ConfigSlurper()
// fix classloader problem using ConfigSlurper in job dsl
slurper.classLoader = this.class.classLoader
def config = slurper.parse(readFileFromWorkspace('microservices.dsl'))
// create job for every microservice
config.microservices.each { name, data ->
createBuildJob(name,data)
createITestJob(name,data)
createDeployJob(name,data)
}
// create nested build pipeline view
nestedView('Build Pipeline') {
description('Shows the service build pipelines')
columns {
status()
weather()
}
views {
config.microservices.each { name,data ->
println "creating build pipeline subview for ${name}"
buildPipelineView("${name}") {
selectedJob("${name}-build")
triggerOnlyLatestJob(true)
alwaysAllowManualTrigger(true)
showPipelineParameters(true)
showPipelineParametersInHeaders(true)
showPipelineDefinitionHeader(true)
startsWithParameters(true)
}
}
}
}
def createBuildJob(name,data) {
freeStyleJob("${name}-build") {
scm {
git {
remote {
url(data.url)
}
branch(data.branch)
createTag(false)
}
}
triggers {
scm('H/15 * * * *')
}
steps {
maven {
mavenInstallation('3.1.1')
goals('clean install')
}
}
publishers {
archiveJunit('/target/surefire-reports/*.xml')
downstream("${name}-itest", 'SUCCESS')
}
}
}
def createITestJob(name,data) {
freeStyleJob("${name}-itest") {
publishers {
downstream("${name}-deploy", 'SUCCESS')
}
}
}
def createDeployJob(name,data) {
freeStyleJob("${name}-deploy") {}
}