【发布时间】:2016-02-12 05:45:36
【问题描述】:
我想知道如何使用 IBM Bluemix Dev Ops Services 构建一个包含私有 git 子模块的项目。
在我的管道中,我有一个类型为“Shell Script”的“构建”工作:
#!/bin/bash
git submodule init
git submodule update --recursive
但我的子模块包含许多私有存储库,我得到:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
在我的本地机器上,我能够运行这些命令,因为我可以访问并且我正在使用我的密钥。我该怎么做才能让它在这里工作?我不想将我的私钥提交到 git 中。
我正在部署的应用程序的存储库托管在 GitHub 上。私有子模块托管在 BitBucket 上。
更新
我尝试在构建控制台中使用我的私钥,但它不起作用:
echo "... my private key ..." >> ~/.ssh/throwaway_key
chmod 400 ~/.ssh/throwaway_key
ssh-agent bash -c 'ssh-add ~/.ssh/throwaway_key; git submodule update --recursive'
因为我在 docker 容器内,它不工作吗?我必须更新/etc/ssh/ssh_config 吗?我无法在运行此作业的容器内访问它。
更新 2
我也试过了,没有成功:
echo "Host bitbucket.org
Hostname bitbucket.org
IdentityFile ~/.ssh/throwaway_key
IdentitiesOnly yes" >> ~/.ssh/config
【问题讨论】:
-
您不能将您的密钥粘贴到构建 shell 脚本中并在那里提供吗?否则,Bluemix DevOps 不提供对 SSH 密钥的任何支持
-
@BenRondeau 我根据您的建议尝试了一些方法。你能看到我的更新并给我任何其他建议吗?
-
你有没有错误输出?还是默默地失败了?
-
@BenRondeau 它给了我同样的错误,我没有访问权限。我在本地尝试了
ssh-agent ...解决方案,我可以确认它有效。我也试过编辑~/.ssh/config(请看我的另一个编辑) -
好的。在这一点上,我已经超出了我的深度。我会看看是否可以让我们 DevOps 团队的人加入。谢谢
标签: docker containers ibm-cloud pipeline devops