如何从Google Cloud Scheduler定期触发Google Cloud Build作业 [英] How to trigger a Google Cloud Build job periodically from Google cloud scheduler
问题描述
我在但是找到错误状态:"INVALID_ARGUMENT"
.不知道它是从哪里来的.任何解决此问题的建议,将不胜感激.
But find error status: "INVALID_ARGUMENT"
. did not understand from where it came from. any suggestion to fix this, would be grateful.
推荐答案
您需要按照以下步骤进行触发:
You need to follow the bellow steps to trigger:
1.--创建一个新的服务帐户,然后向其中添加"Cloud Build Service帐户"和"Cloud Scheduler Service代理"角色.
1.- Create a new Service Account and add the "Cloud Build Service Account" and "Cloud Scheduler Service Agent" roles to it.
2.- HTTP方法应为"post".
2.- The HTTP method should be "post".
3.-您必须在主体字段中指定"repoName"和"branchName".使用以下示例.
3.- You must specify in the body field the "repoName" and the "branchName". Use the below as example.
{
"repoName": "MyRepo",
"branchName": "MyBranch"
}
4.-选择添加OAuth令牌"作为Auth标头.
4.- Select "Add OAuth token" as Auth header.
5.-将创建的SA分配给要用于触发您的Cloud Build作业的Cloud Scheduler作业.
5.-Assign the created SA to your Cloud Scheduler Job that want to use to trigger your cloud Build job.
6.-使用此值" https://www.googleapis.com/auth/云平台"作为范围
6.-Use this value "https://www.googleapis.com/auth/cloud-platform" as Scope
一旦进行了这些更改,便可以执行触发器.
Once you have these changes, you will be able to execute the trigger.
这篇关于如何从Google Cloud Scheduler定期触发Google Cloud Build作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!