-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile
More file actions
58 lines (54 loc) · 1.32 KB
/
Jenkinsfile
File metadata and controls
58 lines (54 loc) · 1.32 KB
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
pipeline {
agent { label 'docker' }
environment {
COMPOSE_FILE = './docker-compose.yml:./docker-compose.jenkins.yml'
}
options {
disableConcurrentBuilds()
}
stages {
stage('Build') {
steps {
sh 'rm -fr coverage'
sh 'mkdir tmp'
sh 'docker compose build --pull --parallel'
sh 'docker compose up -d redis1 redis2 web'
}
}
stage('Lint') {
steps {
sh 'docker compose run --rm web npm run eslint'
}
}
stage('Tests') {
steps {
sh '''
docker compose run --rm web npm run test:coverage
image=$(docker ps --all --no-trunc | grep web | cut -f 1 -d " " | head -n 1)
docker cp $image:/usr/src/app/coverage ./coverage
mv coverage/lcov-report/* coverage
'''
// publish html
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: "coverage",
reportFiles: 'index.html',
reportName: 'Coverage Report'
]
}
}
stage('Trigger Deployment') {
when { branch 'main' }
steps {
build job: '../pandapush-instructure', wait: false
}
}
}
post {
cleanup {
sh 'docker compose down --volumes --remove-orphans --rmi all'
}
}
}