Repository: flutter
Issue: Datastore to Firestore Migration
Labels: team-infra,P2,triaged-infra

This is a tracking issue to migrat Datastore to Firestore.

- [x] Supports Firestore client/service https://github.com/flutter/cocoon/pull/3471
- [x] Creates the Firestore instance in GCP, with a name of `cocoon`
- [x] Postsubmit - starts writing data to Firestore instance
  - [x] /api/github-webhook-pullrequest - saves initial commit and tasks https://github.com/flutter/cocoon/pull/3472
  - [x] supports multiple entries for a task retry
    - [x] auto retry - https://github.com/flutter/cocoon/pull/3494
    - [x] manual retry (prod reset api) - https://github.com/flutter/cocoon/pull/3505
  - [x] /api/postsubmit-luci-subscription - updates task status + adds new task entry when retry happens + updates commit status (new) https://github.com/flutter/cocoon/pull/3488, https://github.com/flutter/cocoon/pull/3489
  - [x] /api/push-gold-status-to-github - writes gold status https://github.com/flutter/cocoon/pull/3513
  - [x] /api/push-build-status-to-github- https://github.com/flutter/cocoon/pull/3540
  - [x] /api/reset-prod-task - write task status https://github.com/flutter/cocoon/pull/3505
  - [x] /api/scheduler/batch-backfiller - writes task statuses https://github.com/flutter/cocoon/pull/3510
  - [x] /api/scheduler/vacuum-stale-tasks - writes task status & considers removing if stable https://github.com/flutter/cocoon/pull/3511
  - [x] /api/update-task-status - writes task status https://github.com/flutter/cocoon/pull/3495
  - [x] /api/vacuum-github-commits - writes commit statuses https://github.com/flutter/cocoon/pull/3472
  - [x] release branch support
    - [x] /api/dart-internal-subscription - writes tasks https://github.com/flutter/cocoon/pull/3526
    - [x] /api/webhook-subscription - write new commit for `create` event https://github.com/flutter/cocoon/pull/3525
- [ ] Postsubmit - starts reading data from Firestore instance
  - [x] /api/postsubmit-luci-subscription - read task status https://github.com/flutter/cocoon/pull/3584 
  - [x] /api/push-build-status-to-github - reads recent task statuses https://github.com/flutter/cocoon/pull/3582
  - [x] /api/push-gold-status-to-github - reads gold status https://github.com/flutter/cocoon/pull/3555
  - [ ] /api/reset-prod-task - reads task status
  - [ ] /api/scheduler/batch-backfiller - reads task statuses
  - [ ] /api/scheduler/vacuum-stale-tasks - reads task status & considers removing if stable
  - [ ] /api/vacuum-github-commits - reads commit statuses
  - [x] /api/public/build-status - reads commit/task statues https://github.com/flutter/cocoon/pull/3575
  - [ ] /api/public/get-status - reads commit/task statuses
    - [x] supports firestore commit/task protos https://github.com/flutter/cocoon/pull/3632
    - [ ] creates /api/public/get-status-firestore API
    - [ ] supports [_commitStatusesFromJson](https://github.com/flutter/cocoon/blob/8dfd1b87a230a9eb968b7c92e0b46eb3448d313b/dashboard/lib/service/appengine_cocoon.dart#L63) for firestore
    - [ ] Switch logics to firestore
  - [ ] Scheduler logics
- [ ] Presubmit - writing data to Firestore instance
  - [x] /api/presubmit-luci-subscription - starts updating task status (new)
  - [ ] /api/reset-try-task - starts writing task status (new)
  - [ ] /api/reset-try-task - starts reading task status (new)
- [ ] Migrating logics to Firestore commits (Document) from Datastore commits (Kind)
- [ ] Migrating logics to Firestore tasks (Document) from Datastore tasks (Kind)
- [ ] Migrate historical data from old Datastore to new Firestore
- [ ] Cleans up Datastore data models
- [ ] Cleans up Datastore logics
- [ ] Cleans up data from old Datastore
- [ ] Set up auto backup logic for Firestore data