【发布时间】:2019-06-22 14:12:37
【问题描述】:
我已经阅读了 Rake 中我能找到的大多数缺失的二进制文件,但这种情况有所不同,因为它适用于我的开发环境,但不适用于 Jenkins。
我正在尝试调用 gruntworks 发布的 fetch 二进制文件 (https://github.com/gruntwork-io/fetch)
应该注意的是,Rakefile 在开发机器上可以正常工作,但是当通过 JenkinsFile 在 Jenkins 管道上调用它时,我无法让它工作。
我有一个带有以下调用的 Rakefile
sh "fetch --repo 'https://github.com/gruntwork-io/gruntkms' --tag 'v0.0.5' --release-asset='gruntkms_linux_amd64' _tools/"
问题中的二进制是 有正确的目录结构(完整内容已编辑)
$ ls -al .
drwxrwxr-x 2 1000 1000 4096 Jan 29 10:37 _tools
$ ls -al _tools
lrwxrwxrwx 1 1000 1000 17 Jan 29 10:37 fetch -> fetch_linux_amd64
-rwxr-xr-x 1 1000 1000 7651536 Jan 29 10:16 fetch_linux_amd64
路径已正确设置为包含 _tools 目录。
export PATH='/home/qa/jenkins/workspace/RQ/_tools:/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
然而,我收到以下错误:
sh: fetch: not found
rake aborted!
Command failed with status (127): [fetch --repo 'https://github.com/gr...]
即使我尝试显式调用二进制提取(这是一个 ln),我仍然得到一个未找到脚本的错误代码 (127)
_tools/fetch --repo 'https://github.com/gruntwork-io/gruntkms' --tag 'v0.0.5' --release-asset='gruntkms_linux_amd64' _tools/
sh: _tools/fetch: not found
rake aborted!
Command failed with status (127): [_tools/fetch --repo 'https://github.com/gr...]
我还确认了最新版本的 fetch 二进制文件 (0.3.2) 仍然存在该问题。我不认为这是问题所在,但为了确定性,我尝试了。
【问题讨论】:
-
使用 sh 'printenv' 显示你的 printenv
-
最后,我不聪明。事实上,来自 gruntworks 的 fetch 二进制文件有问题,由于某种原因,它无法在 BM 上的自己的 cd 之外调用,最新版本确实解决了这个问题。 (0.3.2) 我在测试新版本的时候,过程中不由自主地用旧版本覆盖了新版本。
标签: jenkins-pipeline fetch rake rakefile