Go服务Jenkinsfile设置go环境变量无效
stage (‘Build’) {
steps {
container (‘go’) {
echo ‘Building..’
echo ‘编译环境….’
sh ‘export GO111MODULE=on’
sh ‘export CGO_ENABLED=0′
sh ‘export GOPROXY=https://goproxy.cn,direct’
sh ‘go env’
sh ‘cd ${projectName}/cmd/ && CGO_ENABLED=0 go build -o main’
}
}
}