gpt4 book ai didi

docker - Go:在声明性Jenkinsfile中找不到

转载 作者:行者123 更新时间:2023-12-01 20:23:04 29 4
gpt4 key购买 nike

我有Jenkins在Docker上运行,我在github上有以下Jenkinsfile

node {
def root = tool name: 'Go 1.12.6', type: 'go'

ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/project/repo") {
withEnv(["GOROOT=${root}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${root}/bin"]) {
env.PATH="${GOPATH}/bin:$PATH"

stage('Clone repository') {
checkout scm
}


stage('Test repo') {
sh 'go test -v'
}

stage('Build image') {
app = docker.build("docker/repo")
}


stage('Push image') { */
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
}
}
}

但是无论我尝试什么,都会收到以下错误:
+ go version
/var/jenkins_home/jobs/repo/builds/45/src/github.com/project/repo@tmp/durable-00e72894/script.sh: line 1: go: not found

最佳答案

Jenkins 重启可能只是修复它

关于docker - Go:在声明性Jenkinsfile中找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57372425/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com