Golang将Jenkins与Dep结合使用

我使用以下代码在 jenkins </ code>上安装 dep </ code> </ p>

  withEnv([“ GOPATH = $ {JENKINS_HOME} / jobs / $ {JOB_NAME} / builds / $ {BUILD_ID}”]){
结帐scm
sh“ 转到版本”
sh'wget https://raw.githubusercontent.com/golang/dep/master/install.sh'
sh'sh ./install.sh'
sh“ dep sure”
</ 代码> </ pre>

我在日志中看到它复制了垃圾箱</ strong>,但是
当涉及到命令 dep确保</ code>时,我们收到错误消息 找不到dep,该如何克服? </ p>

  13:33:41获取https://github.com/golang/dep/releases/latest..
13:33:42发行代码= v0.5.0 \ n13:33:42正在获取https://github.com/golang/dep/releases/tag/v0.5.0..
13:33:42正在获取https://github.com/golang/dep/releases/download/ v0.5.0 / dep-linux-amd64 ..
13:33:51设置可执行权限。
13:33:51将可执行文件移至/ var / jenkins_home / jobs / go-voter / test / builds / 22 / bin / dep

[管道] sh
13:33:53 + dep确保
13:33:53 /home/jenkins/workspace/go-voter_test@tmp/durable-16613f28/script.sh:1:/home/jenkins/workspace /go-voter_test@tmp/durable-

16613f28/script.sh:dep:找不到</ strong> </ p>
\ n

正如日志中所写,我看到该工具已安装在bin 22 / bin / dep </ code>中,
is与 path </ strong>有某种联系? 如果是这样,我应该如何在jenkins中配置它? </ p>
</ div>

展开原文

原文

I use the following code to install dep on jenkins

withEnv(["GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}"]) {
     checkout scm
     sh "go version"
     sh 'wget https://raw.githubusercontent.com/golang/dep/master/install.sh'
     sh 'sh ./install.sh'
     sh "dep ensure"

I see in the log that it copy the bin but when it comes to command dep ensure we got error that dep not found, how to overcome this ?

13:33:41 Fetching https://github.com/golang/dep/releases/latest..
13:33:42 Release Tag = v0.5.0
13:33:42 Fetching https://github.com/golang/dep/releases/tag/v0.5.0..
13:33:42 Fetching https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64..
13:33:51 Setting executable permissions.
13:33:51 Moving executable to /var/jenkins_home/jobs/go-voter/test/builds/22/bin/dep
[Pipeline] sh
13:33:53 + dep ensure
13:33:53 /home/jenkins/workspace/go-voter_test@tmp/durable-16613f28/script.sh: 1: /home/jenkins/workspace/go-voter_test@tmp/durable-

16613f28/script.sh: dep: not found

As written in the log I see that the tool were installed in the bin 22/bin/dep, is it related somehow to the path ? if so, how should I configure it in jenkins ?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐