-
Notifications
You must be signed in to change notification settings - Fork 36
/
Jenkinsfile
45 lines (42 loc) · 1.21 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
pipeline {
agent any
tools {
go 'go1.14'
}
environment {
GO114MODULE = 'on'
CGO_ENABLED = 0
GOPATH = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}"
}
stages {
stage("unit-test") {
steps {
echo 'UNIT TEST EXECUTION STARTED'
sh 'make unit-tests'
}
}
stage("functional-test") {
steps {
echo 'FUNCTIONAL TEST EXECUTION STARTED'
sh 'make functional-tests'
}
}
stage("build") {
steps {
echo 'BUILD EXECUTION STARTED'
sh 'go version'
sh 'go get ./...'
sh 'docker build . -t shadowshotx/product-go-micro'
}
}
stage('Docker Push') {
agent any
steps {
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'dockerhubPassword', usernameVariable: 'dockerhubUser')]) {
sh "docker login -u ${env.dockerhubUser} -p ${env.dockerhubPassword}"
sh 'docker push shadowshotx/product-go-micro'
}
}
}
}
}