forked from PegaSysEng/pantheon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.smoke
120 lines (111 loc) · 3.55 KB
/
Jenkinsfile.smoke
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
def runDocker(image, cmd) {
powershell """
docker run `
--rm `
-w "${env.WORKSPACE}" `
-v "${env.WORKSPACE}:${env.WORKSPACE}:rw" `
-e "WORKSPACE=${env.WORKSPACE}" `
-e "BUILD_NUMBER=${env.BUILD_NUMBER}" `
$image powershell -C "$cmd"
"""
}
def linuxImages = [
'openjdk:8-jdk',
'openjdk:11-jdk',
'openjdk:12-jdk',
'azul/zulu-openjdk:8',
'azul/zulu-openjdk:11',
'azul/zulu-openjdk:12',
'adoptopenjdk/openjdk8-openj9:latest',
'adoptopenjdk/openjdk11-openj9:latest'
]
def createLinuxBuild(dockerImage) {
return {
stage("Smoke ${dockerImage}") {
node {
checkout scm
docker.image(dockerImage).inside {
try {
timeout(30) {
sh './gradlew --no-daemon ' + params.gradle_options + ' build'
}
} finally {
junit testResults: '**/build/test-results/**/*.xml', allowEmptyResults: true
}
}
}
}
}
}
def linuxImagesPrivate = [
'pegasyseng/jdk:oracle-8-0.0.1',
'pegasyseng/jdk:oracle-11-0.0.1',
'pegasyseng/jdk:corretto-8-0.0.1'
]
def createLinuxBuildPrivateImage(dockerImage) {
return {
stage("Smoke ${dockerImage}") {
node {
checkout scm
docker.withRegistry('https://registry.hub.docker.com', 'dockerhub-pegasysengci') {
docker.image(dockerImage).inside {
try {
timeout(30) {
sh './gradlew --no-daemon ' + params.gradle_options + ' build'
}
} finally {
junit testResults: '**/build/test-results/**/*.xml', allowEmptyResults: true
}
}
}
}
}
}
}
def windowsImages = [
"openjdk:8-windowsservercore",
"openjdk:11-windowsservercore",
"openjdk:12-windowsservercore"
]
def createWindowsBuild(dockerImage) {
return {
stage("Smoke ${dockerImage}") {
node("windows-server-2019") {
checkout scm
try {
timeout(30) {
runDocker(
dockerImage,
".\\gradlew --no-daemon " + params.gradle_options + " build"
)
}
} finally {
junit testResults: "**\\build\\test-results\\**\\*.xml", allowEmptyResults: true
}
}
}
}
}
def builds = [:]
if (params.javas != 'all') {
builds = builds + (windowsImages.findAll {it.contains(params.javas)}.collectEntries {
["Smoke ${it}", createWindowsBuild(it)]
})
builds = builds + (linuxImages.findAll {it.contains(params.javas)}.collectEntries {
["Smoke ${it}", createLinuxBuild(it)]
})
builds = builds + (linuxImagesPrivate.findAll {it.contains(params.javas)}.collectEntries {
["Smoke ${it}", createLinuxBuildPrivateImage(it)]
})
} else {
builds = builds + (windowsImages.collectEntries {
["Smoke ${it}", createWindowsBuild(it)]
})
builds = builds + (linuxImages.collectEntries {
["Smoke ${it}", createLinuxBuild(it)]
})
builds = builds + (linuxImagesPrivate.collectEntries {
["Smoke ${it}", createLinuxBuildPrivateImage(it)]
})
}
parallel builds