【发布时间】:2019-09-04 20:38:18
【问题描述】:
我正在尝试设置一个 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 的设置中的 global tool configuration 中添加了 Go 作为工具。
【问题讨论】:
标签: go jenkins jenkins-pipeline jenkins-plugins devops