How to wait for completion of updating firestore indexes more elegantly

18 views
Skip to first unread message

Han Schipper

unread,
Sep 3, 2021, 5:24:38 AM9/3/21
to Google Cloud Developers

The problem with deploying firestore indexes is that they are long running operations. That means that a deployment call already returns, before all indexes have been updated (see this link). For example, when using Google Cloud Build:

- name: gcr.io/${PROJECT_ID}/firebase args: ['deploy', '--project=${PROJECT_ID}', '--only=firestore:indexes']

How do I wait for completion in my CI/CD build script? I have another successive step in the build script that migrates firestore data, but that is dependent on successful complement of this indexes updating step.

On way is to poll for completion, using this command

gcloud firestore operations list

and check whether there is any operation of type type.googleapis.com/google.firestore.admin.v1.IndexOperationMetadata running

However, this seems tricky and error prone. Does anyone know a better approach?

Reply all
Reply to author
Forward
0 new messages