-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
64 lines (56 loc) · 1.73 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
#!/usr/bin/env groovy
pipeline {
agent {
label 'docker'
}
options {
ansiColor("xterm")
buildDiscarder(logRotator(numToKeepStr: '50'))
timeout(time: 20, unit: 'MINUTES')
}
stages {
stage('Build') {
steps {
sh 'docker-compose down --rmi=all --volumes --remove-orphans'
sh 'docker-compose build --pull'
}
}
stage('Test') {
steps {
sh 'docker-compose run --rm app /bin/bash -lc "rvm-exec 2.7 bin/rubocop"'
sh 'docker-compose run --name coverage app'
}
post {
always {
sh 'docker cp coverage:/app/coverage .'
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'coverage',
reportFiles: 'index.html',
reportName: 'Coverage Report'
]
}
}
}
stage('Publish') {
when {
allOf {
expression { GERRIT_BRANCH == "main" }
environment name: "GERRIT_EVENT_TYPE", value: "change-merged"
}
}
steps {
withCredentials([string(credentialsId: 'rubygems-rw', variable: 'GEM_HOST_API_KEY')]) {
sh 'docker run -e GEM_HOST_API_KEY --rm inst-jobs-statsd_app /bin/bash -lc "./bin/publish.sh"'
}
}
}
}
post {
always {
sh 'docker-compose down --rmi=all --volumes --remove-orphans'
}
}
}