我遇到的所有示例均采用以下格式:
gcloud container builds submit --config cloudbuild.yaml .
手册页内容如下:
[SOURCE]
The source directory on local disk or tarball in Google Cloud Storage
or disk to use for this build. If source is a local directory this
command skips files specified in the .gcloudignore file (see $ gcloud
topic gcloudignore for more information).
现在,我的本地磁盘上的源目录非常大,并且花费了大量时间将源代码从我的本地计算机传输到 Google 构建服务器/云。以下任一情况可能吗?如何?
- 提供 git/github URL 而不是本地源目录
- 我的 git-repo 也顺便被镜像到 Google Source Repository 中,因为我已经为我的 repo 设置了构建触发器。我可以提供 Google 镜像的存储库的 URL 吗?
不幸的是,今天对此没有很大的支持gcloud
。不过,您可以通过其他几种方式来完成此操作:
-
Use curl
或您选择的客户端库发送 API 请求以请求指定指定的构建RepoSource https://cloud.google.com/container-builder/docs/api/reference/rest/v1/RepoSource。例如:
{
“来源”: {
“回购来源”:{
"repoName": "我的仓库",
"commitSha": "死牛肉"
}
},
“脚步”: [...]
}
-
在您的本地环境中,获取提交并使用以下命令构建它gcloud
:
git checkout && gcloud 容器构建提交。 --config=cloudbuild.yaml
创建触发器 https://cloud.google.com/container-builder/docs/running-builds/automate-builds自动执行您的构建,然后发出用于手动运行触发器的 API 请求 https://cloud.google.com/container-builder/docs/api/reference/rest/v1/projects.triggers/run,在您想要的特定提交上,再次使用curl
或客户端库。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)