forked from zowe/zlux-server-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
77 lines (77 loc) · 2.61 KB
/
Jenkinsfile
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
properties([
buildDiscarder(logRotator(numToKeepStr: "25"))
])
node('docker/rsqa/base') {
currentBuild.result = "SUCCESS"
try {
stage('Checkout') {
sh """
git clone https://github.com/zowe/zlux-shared.git
git clone https://github.com/zowe/zlux-platform.git
"""
dir('zlux-server-framework'){
checkout scm
}
}
stage('Build') {
sh """
cd zlux-shared/src/logging
npm install && npm run build
"""
}
stage('Test') {
ansiColor('xterm') {
sh """
cd zlux-server-framework
npm install
npm test -- \\
--reporter mochawesome \\
--reporter-options reportDir=reports,reportFilename=index,html=true,json=true,quiet=true
"""
}
}
} catch (err) {
currentBuild.result = 'FAILURE'
} finally {
stage('Report') {
emailext(
subject: """${env.JOB_NAME} [${env.BUILD_NUMBER}]: ${currentBuild.result}""",
attachLog: true,
mimeType: "text/html",
recipientProviders: [
[$class: 'RequesterRecipientProvider'],
[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider'],
[$class: 'UpstreamComitterRecipientProvider']
],
body: """
<!DOCTYPE html>
<html>
<head>
<title>Build report</title>
</head>
<body>
<p><b>${currentBuild.result}</b></p>
<hr/>
<ul>
<li>Duration: ${currentBuild.durationString[0..-14]}</li>
<li>Console output: <a href="${env.BUILD_URL}console">
${env.JOB_NAME} [${env.BUILD_NUMBER}]</a></li>
</ul>
<hr/>
</body>
</html>
"""
)
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: false,
reportDir: 'zlux-server-framework/reports',
reportFiles: 'index.html',
reportName: 'Report',
reportTitles: ''
])
}
}
}