2
votes

I'm trying to add a build step in my google cloud container builder setup.

The step will create datastore indexes for my project from the index.yaml file provided in the source tree.

Basically I have this cloudbuild.yml:

steps:
- name: gcr.io/cloud-builders/gcloud
  args: ["datastore", "create-indexes", "index.yaml", "-q"]

When I run this I get this error from the gcloud tool:

ERROR: (gcloud.datastore.create-indexes) You are currently logged into gcloud using a service account which does not have the appropriate access to ****. The account has the following scopes: https://www.googleapis.com/auth/logging.write, https://www.googleapis.com/auth/projecthosting, https://www.googleapis.com/auth/pubsub, https://www.googleapis.com/auth/devstorage.read_write. It needs https://www.googleapis.com/auth/cloud-platform in order to succeed. Please recreate this VM instance with the missing scopes. You may also log into a standard account that has the appropriate access by using gcloud auth login.

I tried adding the IAM role "Cloud datastore index admin" to the project "@cloudbuild.gserviceaccount.com" service account, but that did not help.

Is there a simple way to get this working, i.e. granting the container builder service account the required privilege to create datastore indexes?

1

1 Answers

1
votes

Try adding the "Cloud Datastore Owner" or "Project Editor" permissions.