通过gcloud命令行工具触发特定git提交的构建 [英] Triggering a build for a specific git commit via gcloud commandline tool
问题描述
我遇到的所有示例都具有以下格式:
All the examples that I've come across have been of the following format:
gcloud container builds submit --config cloudbuild.yaml .
该手册页显示以下内容:
The man-page says the following:
[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构建服务器/云.下列其中一种可能吗?怎么样?
Now, the source-directory on my local disk is very large and a lot of time is being spent in transferring the source code from my local machine to the Google build servers/cloud. Is either of the following possible? How?
- 提供git/github URL而不是本地源目录
- 我的git-repo也偶然在Google Source Repository中进行了镜像,因为我为我的repo设置了构建触发器.我可以给Google镜像的存储库提供URL吗?
推荐答案
遗憾的是,今天gcloud
中对此功能的支持不大.不过,您可以通过其他几种方式来完成此操作:
Unfortunately there isn't great support for this today in gcloud
. You can accomplish this a few other ways though:
Use
curl
or the client library of your choice to send an API request to request a build that specifies aRepoSource
. For example:
{ 来源": { "repoSource":{ "repoName":"my-repo", "commitSha":死牛肉" } }, 脚步": [...] }
{ "source": { "repoSource": { "repoName": "my-repo", "commitSha": "deadbeef" } }, "steps": [...] }
在您的本地环境中,获取提交并使用gcloud
进行构建:
In your local environment, fetch the commit and build it using gcloud
:
git checkout&& gcloud容器构建提交. --config = cloudbuild.yaml
git checkout && gcloud container builds submit . --config=cloudbuild.yaml
创建触发器自动执行您的构建,然后发出再次使用curl
或客户端库,API请求针对特定的提交手动运行触发器.
Create a trigger that automatically executes your build, then issue an API request to run the trigger manually, on the specific commit you want, again using curl
or a client library.
这篇关于通过gcloud命令行工具触发特定git提交的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!