-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
45 lines (44 loc) · 896 Bytes
/
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
pipeline {
agent {
label 'ubuntu_docker_label'
}
tools {
go "Go 1.11"
}
options {
checkoutToSubdirectory('src/github.com/catalog')
}
environment {
GOPATH = "$WORKSPACE"
DIRECTORY = "src/catalog"
}
stages {
stage("Lint") {
steps {
sh "cd $DIRECTORY && make fmt && git diff --exit-code > /dev/null"
}
}
stage("Test") {
steps {
sh "cd $DIRECTORY && make test"
}
}
stage("Build") {
steps {
withDockerRegistry([credentialsId: "<insert-the-creds-id>", url: ""]) {
sh "cd $DIRECTORY && make docker push"
}
}
}
stage("Push") {
when {
branch "master"
}
steps {
withDockerRegistry([credentialsId: "<insert-the-creds-id>", url: ""]) {
sh "cd $DIRECTORY && make push IMAGE_VERSION=latest"
}
}
}
}
}