-
Notifications
You must be signed in to change notification settings - Fork 40
/
Jenkinsfile
48 lines (47 loc) · 1.36 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
#! /usr/bin/env groovy
pipeline {
agent { label 'docker' }
stages {
stage('Build') {
steps {
sh 'docker-compose build --pull'
// Start a container once to create a network, otherwise there could be
// a race condition in the parallel stages below.
sh 'docker-compose run --rm -dT --name=web_test web'
}
}
stage('Verify') {
parallel {
stage('Test') {
steps {
sh 'docker exec web_test npm run test-cov'
sh 'docker cp $(docker ps -q -f "name=web_test"):/usr/src/app/coverage coverage'
sh 'docker stop web_test'
}
}
stage('Security') {
steps {
withCredentials([string(credentialsId: 'SNYK_TOKEN', variable: 'SNYK_TOKEN')]) {
sh 'docker-compose run --rm -T --name=web_security -e SNYK_TOKEN=$SNYK_TOKEN web npm run security:dependency-monitor || true'
}
}
}
stage('Lint') {
steps {
sh 'docker-compose run --rm -dT --name=web_lint web npm run lint'
}
}
stage('Formatting') {
steps {
sh 'docker-compose run --rm -dT --name=web_formatting web npm run fmt:check'
}
}
}
}
}
post {
cleanup {
sh 'docker-compose down --volumes --remove-orphans --rmi all'
}
}
}