-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
116 lines (102 loc) · 3.75 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
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
#!/usr/bin/env groovy
@Library('tkutils')
import tk.jenkins.common.*
import static tk.jenkins.slack.SlackNotify.notifySlack
def podLabel = UUID.randomUUID().toString()
def gitBranch = 'unknown'
podTemplate(
label: podLabel,
yaml: PodSecurityContext.ROOT,
containers: [
containerTemplate(
name: 'node',
image: 'docker.io/node:14.19.0',
alwaysPullImage: true,
ttyEnabled: true,
command: 'cat',
workingDir: '/home/jenkins/agent',
resourceRequestCpu: '500m',
resourceRequestMemory: '5120Mi',
resourceLimitMemory: '5120Mi',
)
],
volumes: [
secretVolume(mountPath: '/secrets', secretName: 'jenkins-service-account')
]
)
{
node(podLabel) {
try {
currentBuild.result = 'SUCCESS'
gitBranch = GitHelper.getCurrentBranch(this)
print "checking out '${gitBranch}' branch..."
stage('checkout') {
checkout scm
}
stage('install') {
container('node') {
sh 'yarn install'
}
}
stage('build') {
container('node') {
sh 'yarn build'
}
}
stage('checks & tests') {
container('node') {
sh 'yarn ci'
}
}
stage('coverage') {
container('node') {
parallel(
'unit': {
sh 'yarn test:coverage:unit'
},
'int': {
sh 'yarn test:coverage:int'
}
)
}
}
} catch (any) {
currentBuild.result = 'FAILURE'
throw any
} finally {
publishHTML(target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : './html-reports',
reportFiles : 'lint-report.html',
reportTitles : 'ESLint',
reportName : 'ESLint Report'
])
publishHTML(target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : '.',
reportFiles : """packages/payment-widget/html-reports/jest-report.html, \
packages/server-extension/html-reports/int/jest-report.html, \
packages/server-extension/html-reports/unit/jest-report.html""",
reportTitles : 'Widget, Server-Int, Server-Unit',
reportName : 'Test Reports'
])
publishHTML(target: [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : '.',
reportFiles : """packages/payment-widget/html-reports/coverage/index.html, \
packages/server-extension/html-reports/int/coverage/index.html, \
packages/server-extension/html-reports/unit/coverage/index.html""",
reportTitles : 'Widget, Server-Int, Server-Unit',
reportName : 'Code Coverage Reports'
])
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: ''])
notifySlack(this, "cybersource-jenkins", false)
}
}
}