如何从 Google 云调度程序定期触发 Google 云构建作业

How to trigger a Google Cloud Build job periodically from Google cloud scheduler

我在 enter link description here

之后配置了一个云调度程序作业

但是发现错误status: "INVALID_ARGUMENT"。不明白从哪里来的。任何解决此问题的建议,将不胜感激。

您需要按照以下步骤触发:

1.- 创建一个新的 Service Account 并向其添加 "Cloud Build Service Account" 和 "Cloud Scheduler Service Agent" 角色。

2.- HTTP 方法应该是 "post".

3.- 您必须在 body 字段中指定 "repoName" 和 "branchName"。使用以下示例。

{
  "repoName": "MyRepo",
  "branchName": "MyBranch"
}

4.- Select "Add OAuth token" 作为 Auth header.

5.-将创建的 SA 分配给要用于触发云构建作业的 Cloud Scheduler 作业。

6.-使用这个值“https://www.googleapis.com/auth/cloud-platform”作为范围

完成这些更改后,您就可以执行触发器了。