-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
40 lines (37 loc) · 1.26 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
pipeline {
agent none
stages {
stage('Test') {
agent {
docker {
image 'golang:1.14-alpine'
args '-u 0:0 -v /tmp:/root/.cache'
}
}
environment {
GO114MODULE = 'on'
CGO_ENABLED = 0
GOPATH = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}"
}
steps {
echo 'Installing dependencies'
sh 'go version'
sh 'go mod download'
withEnv(["PATH+GO=${GOPATH}/bin"]){
echo 'Running vetting'
sh 'go vet ./...'
echo 'Running test'
sh 'go test -v ./...'
}
}
}
}
post {
always {
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
to: "${params.RECIPIENTS}",
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
}
}
}