2021-03-30 19:42:49 -04:00
|
|
|
pipeline {
|
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'golang:latest'
|
2021-03-30 20:47:50 -04:00
|
|
|
args '--privileged'
|
2021-03-30 19:42:49 -04:00
|
|
|
}
|
|
|
|
}
|
2021-03-30 20:55:46 -04:00
|
|
|
environment {
|
|
|
|
GO114MODULE = 'on'
|
|
|
|
CGO_ENABLED = 0
|
|
|
|
GOPATH = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}"
|
|
|
|
}
|
2021-03-30 19:42:49 -04:00
|
|
|
stages {
|
2021-03-30 20:49:53 -04:00
|
|
|
stage('Setup') {
|
|
|
|
steps {
|
2021-03-30 20:52:34 -04:00
|
|
|
sh "mkdir -p .cache/go-build"
|
|
|
|
sh "chmod 777 .cache/go-build"
|
2021-03-30 20:49:53 -04:00
|
|
|
}
|
|
|
|
}
|
2021-03-30 19:42:49 -04:00
|
|
|
stage('Build') {
|
|
|
|
steps {
|
|
|
|
sh "go build"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Test') {
|
|
|
|
steps {
|
|
|
|
sh "go test ./... -v"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|