-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpipeline-view.dsl
63 lines (52 loc) · 1.22 KB
/
pipeline-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
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 build pipeline view for every service
config.microservices.each { name, data ->
buildPipelineView(name) {
selectedJob("${name}-build")
}
}
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") {}
}