-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
116 lines (109 loc) · 2.46 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
pipeline {
agent any
options {
timestamps()
skipStagesAfterUnstable()
buildDiscarder(logRotator(numToKeepStr: '30'))
}
/*
nvm wrapper has to wrap all steps, interestingly its not supposed to work with the .nvmrc file however if you exclude the version as a blank
string
then it passes the blank string as the version and therefore nvm just does its job and uses the .nvmrc file.
*/
stages {
stage('Tool Versions') {
steps {
nvm('') {
sh 'npm i -g npm@8.3.0'
sh 'node --version'
sh 'npm --version'
}
}
}
stage('Install') {
steps {
nvm('') {
sh 'npm install -g npm-check'
sh 'npm install -g @angular/cli'
sh 'npm ci'
}
}
}
stage('License Header Check') {
steps {
warnError('Missing License Headers') {
nvm('') {
sh 'npm run license-check check'
}
}
}
}
stage('Lint') {
steps {
nvm('') {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
sh 'npm run eslint-report'
}
}
}
post {
always {
recordIssues qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]], tools: [esLint(pattern: '**/eslint_report.xml')]
}
}
}
stage('Build') {
steps {
nvm('') {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
sh 'npm run build'
}
}
}
}
stage('Link into jenkins npm') {
when {
branch 'develop'
}
steps {
nvm('') {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
sh 'npm link'
}
}
}
}
// stage('Sonarqube') {
// when {
// branch 'develop'
// }
// steps {
// withSonarQubeEnv('JenkinsQube') {
// nvm('') {
// catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
// sh 'npm run sonar'
// }
// }
// }
// }
// }
stage('Publish main branch') {
when {
branch 'main'
}
steps {
nvm('') {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
sh 'npm publish'
}
}
}
}
}
post {
always {
outputTestResults()
//zulipNotification(topic: 'mdm-resources')
}
}
}