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 listand 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?