forked from instructure/api-client-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
executable file
·61 lines (55 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
49
50
51
52
53
54
55
56
57
58
59
60
61
pipeline {
agent {
label 'docker'
}
options {
parallelsAlwaysFailFast()
}
stages {
stage('Build') {
steps {
sh 'docker compose build --pull'
}
}
stage('Spec') {
steps {
sh 'docker compose run api_client_builder bundle exec rspec --format doc'
sh '''
image=$(docker ps --all --no-trunc | grep spec | cut -f 1 -d " " | head -n 1)
docker cp "$image:/usr/src/app/coverage" .
'''
sh 'ls -als coverage'
}
post {
always {
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'coverage',
reportFiles: 'index.html',
reportName: 'Coverage Report'
]
}
}
}
stage('Publish') {
when {
allOf {
expression { GERRIT_BRANCH == 'master' }
environment name: 'GERRIT_EVENT_TYPE', value: 'change-merged'
}
}
steps {
withCredentials([string(credentialsId: 'rubygems-rw', variable: 'GEM_HOST_API_KEY')]) {
sh 'docker compose run -e GEM_HOST_API_KEY --rm api_client_builder /bin/bash -lc "./bin/publish.sh"'
}
}
}
}
post {
cleanup {
sh 'docker compose down --rmi=all --volumes --remove-orphans'
}
}
}