[英]IBM Cloud Code Engine fails to build for private repo
I'm using IBM Cloud Code Engine to build the source code from a private git repo .我正在使用IBM Cloud Code Engine 从私有 git 存储库构建源代码。 I have tried many times, and the buildrun always failed.
我试过很多次,buildrun总是失败。 Following are the steps I have done.
以下是我已经完成的步骤。
Add my public key (/root/.ssh/id_rsa.pub) to my private repo as a deploy key将我的公钥 (/root/.ssh/id_rsa.pub) 作为部署密钥添加到我的私人仓库
Use IBM Cloud Code Engine CLI to create repo access credential ibmcloud ce repo create --name ibmgithub --key-path /root/.ssh/id_rsa --host github.ibm.com
使用 IBM Cloud Code Engine CLI 创建存储库访问凭证
ibmcloud ce repo create --name ibmgithub --key-path /root/.ssh/id_rsa --host github.ibm.com
Use IBM Cloud Code Engine CLI to create a build and then submit a build run ibmcloud ce build create --name minion --image us.icr.io/mynamespace/myimg --rs ce-default-icr-us-south --git-repo-secret ibmgithub --source https://github.ibm.com/myaccount/myrepo --strategy dockerfile --size medium
使用 IBM Cloud Code Engine CLI 创建构建,然后提交构建运行
ibmcloud ce build create --name minion --image us.icr.io/mynamespace/myimg --rs ce-default-icr-us-south --git-repo-secret ibmgithub --source https://github.ibm.com/myaccount/myrepo --strategy dockerfile --size medium
The build run always fails构建运行总是失败
#:~/synthetics-private-minion# ibmcloud ce bd get -n minion
Getting build 'minion'
OK
Name: minion
ID: 0abc63a0-07d5-42c5-b70a-227e52310276
Project Name: private location
Project ID: 25491342-e9e8-4ac7-90ff-b9994cda9242
Age: 6m24s
Created: 2021-03-31T04:11:41-05:00
Status: Succeeded
Reason: all validations succeeded
Image: us.icr.io/mynamespace/myimg
Registry Secret: ce-default-icr-us-south
Build Strategy: kaniko-medium
Timeout: 10m0s
Source: https://github.ibm.com/myaccount/myrepo
Commit: main
Dockerfile: Dockerfile
Repo Secret: ibmgithub
Build Runs:
Name Status Age
minion-run-sj5fl "step-git-source-source-cm7pc" exited with code 1 (image: "icr.io/obs/codeengine/tekton-pipeline/git-init-4874978a9786b6625dd8b6ef2a21aa70@sha256:47b8008fa1910fa36c8284871eb9d8e7fbab8bc3a1db4cdd97c61d88727cc58f"); for logs run: kubectl -n 7pztl5cw3ad logs minion-run-sj5fl-nbzft-pod-rx9x9 -c step-git-source-source-cm7pc 5m42s
Never used
.Never used
。 Can anyone shed some light on it?任何人都可以对此有所了解吗? Thanks.
谢谢。
The build capability of IBM Cloud Code Engine can access source code in public and private repositories. IBM Cloud Code Engine 的构建功能可以访问公共和私有存储库中的源代码。 There are two criteria for a repository to be public:
公开存储库有两个标准:
The second criteria makes your repository a private one from Code Engine perspective.从代码引擎的角度来看,第二个标准使您的存储库成为私有存储库。 To address a repository in a Code Engine build, there is a simple rule:
要在代码引擎构建中处理存储库,有一个简单的规则:
You correctly specify a repository access secret, but must change your source URL to use the SSH protocol.您正确指定了存储库访问密钥,但必须更改您的源 URL 以使用 SSH 协议。 The easiest way to find the URL, is the Code drop-down in GitHub:
找到 URL 的最简单方法是 GitHub 中的代码下拉菜单:
So it should be git@github.ibm.com/myaccount/myrepo in your case.所以在你的情况下应该是git@github.ibm.com/myaccount/myrepo 。
Further references:更多参考资料:
Instructions on how to setup a repository access secret can be found in Accessing private code repositories .可以在访问私有代码存储库中找到有关如何设置存储库访问密钥的说明。
Troubleshooting for a failed BuildRun can be found in Troubleshooting tips for builds .构建运行失败的故障排除可以在构建故障排除提示中找到。 It includes instructions to retrieve the logs from your BuildRun and translates the error message you see into the root cause with steps to resolve them.
它包括从 BuildRun 检索日志的说明,并将您看到的错误消息转换为根本原因以及解决它们的步骤。
Since you're using an ssh key, make sure the URL to your git repo starts with git@
instead of https://
. Since you're using an ssh key, make sure the URL to your git repo starts with
git@
instead of https://
. So it should be git@github.ibm.com/myaccount/myrepo in your case.所以在你的情况下应该是git@github.ibm.com/myaccount/myrepo 。
For further issues with failing builds, you can check the related troubleshooting buildruns section in the Code Engine docs .有关构建失败的更多问题,您可以查看代码引擎文档中的相关故障排除构建运行部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.