ci(flutter_agy_docker): conditionally tag docker images by release channel (#5086)
Add `orchestrator.yaml` to fetch the latest `stable` Flutter version and automatically trigger the `flutter-agy-docker` build with the correct version substitution.
Update `cloudbuild.yaml` to fetch the official Flutter releases JSON and conditionally apply docker tags:
- Tag and push as `stable` and `latest` if the built version matches the current stable release.
- Tag and push as `beta` if the built version matches the current beta release.
- Remove the unconditional `latest` tagging that applied to every build.
Flows:
```mermaid
sequenceDiagram
autonumber
actor Scheduler as Cloud Scheduler
actor User as Manual Trigger
participant Orchestrator as orchestrator.yaml
participant CloudBuild as cloudbuild.yaml
participant Storage as Google Cloud Storage (Releases)
participant AR as Artifact Registry
%% Cloud Scheduler Flow
rect rgb(240, 248, 255)
note over Scheduler, AR: Flow 1: Automated Stable Build
Scheduler->>Orchestrator: Trigger daily/weekly
Orchestrator->>Storage: Fetch releases_linux.json
Storage-->>Orchestrator: Return JSON
Orchestrator->>Orchestrator: Parse latest stable version (e.g. 3.44.4)
Orchestrator->>CloudBuild: gcloud builds triggers run <br/>(_FLUTTER_VERSION=3.44.4)
CloudBuild->>CloudBuild: Build images (flutter_base, flutter_docker)
CloudBuild->>Storage: Fetch releases_linux.json (Step 3)
Storage-->>CloudBuild: Return JSON
CloudBuild->>CloudBuild: Compare _FLUTTER_VERSION to stable/beta
note right of CloudBuild: Matches Stable
CloudBuild->>AR: Push tag: :3.44.4
CloudBuild->>AR: Push tag: :stable
CloudBuild->>AR: Push tag: :latest
end
%% Manual Trigger Flow
rect rgb(255, 248, 240)
note over User, AR: Flow 2: Manual Version Build
User->>CloudBuild: Trigger manually <br/>(_FLUTTER_VERSION=X.Y.Z)
CloudBuild->>CloudBuild: Build images (flutter_base, flutter_docker)
CloudBuild->>Storage: Fetch releases_linux.json (Step 3)
Storage-->>CloudBuild: Return JSON
CloudBuild->>CloudBuild: Compare _FLUTTER_VERSION to stable/beta
alt Matches Stable Version
CloudBuild->>AR: Push tag: :X.Y.Z
CloudBuild->>AR: Push tag: :stable
CloudBuild->>AR: Push tag: :latest
else Matches Beta Version
CloudBuild->>AR: Push tag: :X.Y.Z
CloudBuild->>AR: Push tag: :beta
else Neither (Random Version)
CloudBuild->>AR: Push tag: :X.Y.Z
note right of CloudBuild: Skips stable, latest, and beta tags
end
end
```Cocoon is a Dart App Engine custom runtime (backend) with a frontend of Flutter apps (build and repository dashboard). Cocoon coordinates and aggregates the results of flutter/flutter builds.
It is not designed to help developers build Flutter apps.
Cocoon is not a Google product.
The server is driven by commits made to https://github.com/flutter/flutter repo. It periodically syncs new commits. If you need to manually force a refresh, query https://flutter-dashboard.appspot.com/api/refresh-github-commits.
You will need to be authenticated with Cocoon to do this.
Cocoon has several components:
A server, which coordinates everything. This is a Dart App Engine application. If you have never used that before, you may want to peruse the samples for Dart App Engine. The server is found in app_dart.
A Flutter app (generally used as a Web app) for the build dashboards. The dashboard is found in dashboard.
Cocoon creates a checklist for each Flutter commit. A checklist is made of multiple tasks. Tasks are performed by LUCI bots.
First, set up a Flutter development environment. This will, as a side-effect, provide you with a Dart SDK. Your life will be easier if you add that (.../flutter/bin/cache/dart-sdk/bin/) to your path.
To update the production server, you will need the Google Cloud SDK. Since there is no Dart SDK, we just use the command line tools.
All the commands in this section assume that you are in the app_dart/ directory.
dart bin/local_server.dart
This will output Serving requests at 0.0.0.0:8080 indicating the server is working.
New requests will be logged to the console.
To run live tests, build the app, and provide instructions for deploying to Google App Engine, run this command:
dart dev/deploy.dart --project {PROJECT} --version {VERSION}
You can test the new version by accessing {VERSION}-dot-flutter-dashboard.appspot.com in your browser. If the result is satisfactory, the new version can be activated by using the Cloud Console UI: https://console.cloud.google.com/appengine/versions?project=flutter-dashboard&serviceId=default
--profile: Deploy a profile mode of dashboard application for debugging purposes.
--ignore-version-check: Ignore the version of Flutter on path (expects to be relatively recent)
The dashboard application will use dummy data when it is not connected to the server, so it can be developed locally without a dev server.
To run the dashboard locally, go into the dashboard directory and run flutter run -d chrome --dart-define=FAKE_AUTH=true. The dashboard will be served from localhost (the exact address will be given on the console); copy the URL into your browser to view the application. (The dashboard should also be able to run on non-Web platforms, but since the Web is our main target that is the one that should generally be used for development.)
You can run flutter packages upgrade to update the dependencies. This may be necessary if you see a failure in the dependencies.