mod-jenkfile #1
17
Jenkinsfile
vendored
17
Jenkinsfile
vendored
@@ -1,17 +1,30 @@
|
||||
pipeline {
|
||||
agent { docker { image 'golang:1.15-alpine'
|
||||
args '-e XDG_CACHE_HOME="/tmp" -e CGO_ENABLED=0 -e GOCACHE="/tmp/.cache"'} }
|
||||
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}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user