-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
70 lines (68 loc) · 2.15 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
#!groovy
@Library('kanolib') _
pipeline {
agent {
label 'ubuntu_18.04_with_docker'
}
post {
always {
junit allowEmptyResults: true, testResults: 'test-results.xml'
cobertura coberturaReportFile: 'coverage/cobertura-coverage.xml'
step([$class: 'CheckStylePublisher', pattern: 'eslint.xml'])
}
regression {
notify_culprits currentBuild.result
}
fixed {
notify_culprits currentBuild.result
}
}
stages {
stage('checkout') {
steps {
checkout scm
}
}
stage('install dependencies') {
steps {
script {
docker.image('node:8-alpine').inside('-u root') {
withCredentials([string(credentialsId: 'npm-read-only', variable: 'NPM_TOKEN')]) {
sh "apk update && apk upgrade && apk add --no-cache bash git openssh"
sh "mkdir -p ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts"
sh "echo \"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\" > ~/.npmrc"
sshagent(['read-only-github']) {
sh "yarn"
}
}
}
}
}
}
stage('lint') {
steps {
script {
docker.image('node:8-alpine').inside {
sh "yarn ci:lint"
}
}
}
}
stage('test') {
steps {
script {
// Use puppeteer enabled docker image
docker.image('kanocomputing/puppeteer').inside('--cap-add=SYS_ADMIN') {
// Run the Unit test
sh "yarn ci:test"
sh "yarn ci:coverage"
}
}
}
}
}
options {
// Only keep a fixed amount of builds
buildDiscarder(logRotator(numToKeepStr: '20'))
}
}