根据一个note https://cloud.google.com/cloud-build/docs/access-private-github-repos在 Cloud Build 文档中,标题为访问私有 GitHub 存储库:
当您使用 Cloud Build 触发器运行构建时,您可以自动连接到您拥有的任何私有存储库,而无需将凭据存储在 Secret Manager 中。
基于此,我尝试过git clone
我的私人 GitHub 存储库(没有将 ssh 密钥从 Secret Manager 传输到 ssh 文件,文档指出使用构建触发器是不必要的)无济于事。在我的下面使用 sshcloudbuild.yaml
file:
steps:
- name: google/cloud-sdk:alpine
id: Clone repo
entrypoint: git
args: ['clone', '[email protected] /cdn-cgi/l/email-protection:my-org/my-repo.git']
结果出现错误:
Step #0: Host key verification failed.
Step #0: fatal: Could not read from remote repository.
并使用 https
args: ['clone', 'https://github.com/my-org/my-repo.git']
I get:
Step #0 - "Clone repo": fatal: could not read Username for 'https://github.com': No such device or address
有没有办法克隆私有 GitHub 存储库cloudbuild.yaml
无需在克隆之前将 ssh 密钥从 Secret Manager 繁琐地通过管道传送到卷?任何提示将不胜感激。
正如在note https://cloud.google.com/cloud-build/docs/access-private-github-repos共享,您需要配置您的云构建触发器 https://cloud.google.com/build/docs/automating-builds/create-manage-triggers#connect_repo,如果你想避开秘密经理。
构建触发器设置步骤涉及使用您的用户名和密码对源存储库进行身份验证。
因此,当您触发此云构建触发器时,它不会要求您在 Secret Manager 中提供凭据,因为身份验证已在前面的步骤(触发器设置)中提供。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)