我正在尝试设置一个Jenkins Blue Ocean管道,以便在PR合并时自动构建我的github存储库。
我已经为Jenkins安装了Go插件,并在Blue Ocean的帮助下创建了以下Jenkinsfile。只是希望它是非常简单的一开始-我有一个shell脚本运行,将构建程序,我只需要Jenkins来运行它的合并。
pipeline {
agent any
stages {
stage('Building Backend') {
agent any
steps {
echo 'Using Go 1.12'
tool(name: 'Go 1.12', type: 'go')
echo 'Building Backend...'
sh 'go version'
}
}
}
}上面的Jenkinsfile返回
go: command not found
script returned exit code 127但理想情况下,我希望它能够识别Go,因为我将运行一个go build命令日志。我在Jenkins的设置中将Go作为工具添加到了global tool configuration中。
发布于 2019-09-04 08:14:31
您可以尝试执行以下命令,以确定go CLL是否存在:
sh 'which go'发布于 2019-09-04 20:38:18
Jenkins插件不安装可执行文件。把它们想象成控制器。您应该在系统中安装Go,并告诉Jenkins可执行文件在Global Tool Configuration中的路径。
你可以在这里看到一个Git的例子:

https://stackoverflow.com/questions/57778407
复制相似问题