-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
50 lines (46 loc) · 1.28 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
pipeline {
agent any
tools {
go 'golang 1.21.3'
}
environment {
CGO_ENABLED=1
GOPATH = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage("unit-test") {
steps {
echo 'UNIT TEST EXECUTION STARTED'
sh 'make test'
}
}
stage("code-coverage") {
steps {
echo 'CODE COVERAGE EXECUTION STARTED'
sh 'make coverage'
}
}
stage("build") {
steps {
echo 'BUILD EXECUTION STARTED'
sh 'go version'
sh 'go get ./...'
sh 'docker build . -t jtelio/clean-architecture-go'
}
}
stage('deliver') {
agent any
steps {
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'dockerhubPassword', usernameVariable: 'dockerhubUser')]) {
sh "docker login -u ${env.dockerhubUser} -p ${env.dockerhubPassword}"
sh 'docker push jtelio/clean-architecture-go'
}
}
}
}
}