Aniket
Aniket

Reputation: 545

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

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.

Upvotes: 1

Views: 964

Answers (1)

Samuel Romero
Samuel Romero

Reputation: 1253

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.

Upvotes: 4

Related Questions