31 lines
966 B
Groovy
31 lines
966 B
Groovy
pipeline {
|
|
agent none
|
|
stages {
|
|
stage('build') {
|
|
agent { docker { image 'golang:1.15-alpine'
|
|
args '-e XDG_CACHE_HOME="/tmp" -e CGO_ENABLED=0 -e GOCACHE="/tmp/.cache"'} }
|
|
steps {
|
|
sh 'go version'
|
|
sh 'go env'
|
|
}
|
|
}
|
|
stage('Test') {
|
|
agent { docker { image 'golang:1.15-alpine'
|
|
args '-e XDG_CACHE_HOME="/tmp" -e CGO_ENABLED=0 -e GOCACHE="/tmp/.cache"'} }
|
|
steps {
|
|
sh 'go test'
|
|
}
|
|
}
|
|
stage('Sonar-Test') {
|
|
agent {
|
|
docker { image 'sonarsource/sonar-scanner-cli' }
|
|
}
|
|
steps {
|
|
withSonarQubeEnv('mysonar') { // If you have configured more than one global server connection, you can specify its name
|
|
sh "sonar-scanner -Dsonar.projectKey=hey:${BRANCH_NAME}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|