-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
56 lines (45 loc) · 1.06 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
node("slave") {
stage('prepare') {
checkout scm
}
def containersDown = true
try {
stage('start containers') {
sh 'make docker-up'
containersDown = false
}
stage('go vet') {
sh "make vet-in-docker"
}
stage('go build') {
sh "make build-in-docker"
}
stage('go test') {
sh 'make test-in-docker'
}
stage('go fmt') {
sh "make fmt-in-docker"
}
stage('stop containers') {
sh 'make docker-down'
containersDown = true
}
stage('docker build') {
sh 'make docker-build'
}
if ("${env.BRANCH_NAME}" == "master") {
stage('docker push') {
sh 'make docker-push'
}
}
stage('docker rmi') {
sh 'make docker-rmi'
}
} finally {
if (!containersDown) {
stage ('stop containers') {
sh 'make docker-down'
}
}
}
}