Git jenkins,在shell脚本中使用ssh
更新:2/7-见下面的答案 我似乎无法让git/ssh签出在脚本中工作 什么有效: 我的jenkins作业有一个SSH密钥 Jenkins(通过SSH)通过GIT插件从bitbucket中检出内容,没有问题 我的詹金斯工作是这样的: 詹金斯的工作基本上有两件事:Git jenkins,在shell脚本中使用ssh,git,jenkins,jenkins-plugins,Git,Jenkins,Jenkins Plugins,更新:2/7-见下面的答案 我似乎无法让git/ssh签出在脚本中工作 什么有效: 我的jenkins作业有一个SSH密钥 Jenkins(通过SSH)通过GIT插件从bitbucket中检出内容,没有问题 我的詹金斯工作是这样的: 詹金斯的工作基本上有两件事: 检查带有shell脚本的git模块(在linux机器上) 使用传递的参数执行git模块(即:参数化 建造) 脚本确实(或应该)完成了沙盒目录中的所有工作,这包括签出大约8个其他GIT模块,根据作为参数化构建的一部分传递的值选择分支等 我
[EnvInject] - Loading node environment variables.
Building remotely on myslave - tiopbld (tiop_linux) in workspace /scratch/jenkins/workspace/pybuilder-testing/shellscript_test.sh
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine)
$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-PRUTedOo0d7o/agent.16607
SSH_AGENT_PID=16609
[ssh-agent] Started.
$ ssh-add /scratch/jenkins/workspace/pybuilder-testing/shellscript_test.sh@tmp/private_key_2048740533538871194.key
Identity added: /scratch/jenkins/workspace/pybuilder-testing/shellscript_test.sh@tmp/private_key_2048740533538871194.key (/scratch/jenkins/workspace/pybuilder-testing/shellscript_test.sh@tmp/private_key_2048740533538871194.key)
[ssh-agent] Using credentials tiopbld
Cloning the remote Git repository
Cloning repository ssh://git@bitbucket.myserver.com/pybuild/pythonbuilder.git
> git init /scratch/jenkins/workspace/pybuilder-testing/shellscript_test.sh # timeout=10
Fetching upstream changes from ssh://git@bitbucket.myserver.com/pybuild/pythonbuilder.git
> git --version # timeout=10
using GIT_SSH to set credentials jenkins-tiop-myuser
> git fetch --tags --progress ssh://git@bitbucket.myserver.com/pybuild/pythonbuilder.git +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url ssh://git@bitbucket.myserver.com/pybuild/pythonbuilder.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url ssh://git@bitbucket.myserver.com/pybuild/pythonbuilder.git # timeout=10
Fetching upstream changes from ssh://git@bitbucket.myserver.com/pybuild/pythonbuilder.git
using GIT_SSH to set credentials jenkins-tiop-myuser
> git fetch --tags --progress ssh://git@bitbucket.myserver.com/pybuild/pythonbuilder.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 5255667cfed01bdfcecc558a2c63bd6679503fc7 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 5255667cfed01bdfcecc558a2c63bd6679503fc7
Commit message: "test commit from new linus machine"
First time build. Skipping changelog.
[shellscript_test.sh] $ /bin/sh -xe /tmp/jenkins2668814567868620035.sh
+ git clone ssh://git@bitbucket.myserver.com/pybuild/pythonbuilder.git OUTPUTDIR
Cloning into 'OUTPUTDIR'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Build step 'Execute shell' marked build as failure
$ ssh-agent -k
unsetenv SSH_AUTH_SOCK;
unsetenv SSH_AGENT_PID;
echo Agent pid 16609 killed;
[ssh-agent] Stopped.
Unable to connect to Elasticsearch service. Check Elasticsearch is running in the correct namespace
Finished: FAILURE
```始终仔细检查您的SSH密钥名称。。。 确保他们的名字清楚。。。 例如,“jenkins主从密钥” 还有另一个“jenkins是gitrepo的奴隶” 在我的例子中,一个字母不同的键名。
(在上面)由于其他原因而被隐藏的密钥名称。此处是否需要密码短语保护私钥?否-无密码短语。注意:刚刚添加了显示问题的日志输出。很好+1.您能介绍一下凭证是如何设置的吗?谢谢