如何访问云构建器中的私有Github存储库?
I have two private repositories on Github, A and B. Both are Golang projects. Project A depends on repository B. I have linked both repositories to Google Source Code and consented with permissions.
Cloudbuild.yaml
- name: 'gcr.io/cloud-builders/git'
args: ['clone', 'https://source.developers.google.com/p/$PROJECT_ID/r/B']
Log from container builder
Starting Step #0
Step #0: Already have image (with digest): gcr.io/cloud-builders/git
Step #0: Cloning into 'B'...
Finished Step #0
...
Step #1: [0;33m[WARN] [mUnable to checkout github.com/user/B
Step #1: [0;31m[ERROR] [mUpdate failed for github.com/user/B: Unable to get repository: Cloning into '/builder/home/.glide/cache/src/B'...
Step #1: fatal: could not read Username for 'https://github.com': No such device or address
Step #1: : exit status 128
Have anyone got glide to work with container builder and googles own source repositories? I don't want to use 'Cloud Key Management Service' to solve this issue.
Have already tried: https://github.com/GoogleCloudPlatform/cloud-builders/issues/44#issuecomment-325144047
我在Github上有两个私有存储库,A和B。这两个都是Golang项目。 项目A取决于存储库B。我已将两个存储库都链接到Google源代码并获得许可。 p>
Cloudbuild.yaml p>
- 名称:'gcr.io/cloud-builders/git' args:['clone','https://source.developers.google.com/p/$PROJECT_ID/r/B']
pre>从容器构建器中登录 p>
开始步骤#0 步骤#0:已经有映像(包含摘要):gcr.io / cloud-builders / git 步骤#0:克隆到'B'... 步骤#0 ... 步骤#1:[0; 33m [WARN] [m无法检出github .com / user / B 步骤#1:[0; 31m [ERROR] [对于github.com/user/B,mUpdate失败:无法获取存储库:克隆到'/builder/home/.glide/cache/src/ B'... 步骤#1:致命:无法读取“ https://github.com”的用户名:没有此类设备或地址 步骤#1::退出状态128 code> pre >
有没有人能与容器构建器和Google自己的源存储库一起使用? 我不想使用“云密钥管理服务”来解决此问题。 p>
已经尝试过: https://github.com/GoogleCloudPlatform/cloud-builders/issues/44#issuecomment-325144047 p> DIV>
I have no experience with cloud build but you should use ssh:// instead of https:// for cloning your git repository. then you'll need to add a SSH key to the repo (in github its called deploy keys, either per repo or for your user account) and use the same key when cloning (in Linux its usually enough to put the private key file under ~/.ssh). I guess that solutions you may found which involve Cloud KMS do the same thing but store the private key securely.