-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathJenkinsfile
68 lines (67 loc) · 1.41 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
pipeline {
agent none
options {
timestamps()
ansiColor('xterm')
}
stages {
// stage('lint') {
// agent {
// docker {
// image 'node:lts'
// args '-u root:sudo'
// }
// }
// steps {
// checkout scm
// sh "npm ci"
// sh "npm run lint"
// }
// }
stage('build and test') {
agent {
docker {
image 'node:lts'
args '-u root:sudo'
}
}
steps {
timeout(time: 20, unit: 'MINUTES') {
checkout scm
sh "npm ci"
sh "npm run build"
sh "npm run test:ci"
}
}
post {
always {
archiveArtifacts artifacts: 'junit/*.xml'
// Output custom JSON
script {
def uname = sh(script: 'uname', returnStdout: true).trim()
def props = [
job: STAGE_NAME,
node: NODE_NAME,
os: uname,
container: ""
]
writeJSON file: 'custom.json', json: props, pretty: 4
}
archiveArtifacts artifacts: 'custom.json'
}
}
}
stage('docker build') {
agent any
environment {
DOCKER_BUILDKIT = '1'
}
steps {
timeout(time: 20, unit: 'MINUTES') {
checkout scm
sh "docker build -t ci_analyzer ."
}
}
}
}
}