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

◇◆丶佛笑我妖孽 提交于 2020-05-17 05:55:14

问题


I configured a cloud schedular job following enter link description here

But find error status: "INVALID_ARGUMENT". did not understand from where it came from. any suggestion to fix this, would be grateful.


回答1:


You need to follow the bellow steps to trigger:

1.- Create a new Service Account and add the "Cloud Build Service Account" and "Cloud Scheduler Service Agent" roles to it.

2.- The HTTP method should be "post".

3.- You must specify in the body field the "repoName" and the "branchName". Use the below as example.

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

4.- Select "Add OAuth token" as Auth header.

5.-Assign the created SA to your Cloud Scheduler Job that want to use to trigger your cloud Build job.

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.



来源:https://stackoverflow.com/questions/61682555/how-to-trigger-a-google-cloud-build-job-periodically-from-google-cloud-scheduler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!