Skip to content

evergreen: Generate a truthful build-time manifest.json - #13462

Merged
yuying-y merged 3 commits into
youtube:mainfrom
yuying-y:evergreen_build_time_manifest
Oct 21, 2026
Merged

yuying-y merged 3 commits into
youtube:mainfrom
yuying-y:evergreen_build_time_manifest

Conversation

@yuying-y

Copy link
Copy Markdown
Contributor

Local Evergreen builds did not include a manifest.json under app/<target>/, so both the loader app and the updater fell back to the default Evergreen version 1.0.0 for the system image (slot 0). As a result, a device running a local LTS build would be served any production package whose version is greater than 1.0.0.

This change generates app/<target>/manifest.json at build time with the Evergreen version derived from COBALT_VERSION, following the documented mapping <MAJOR>.lts.<MINOR> → <MAJOR - 20>.<MINOR>.2 (2 denotes the "latest" release candidate). For example, 27.lts.10 maps to 7.10.2 and 27.lts.11 maps to 7.11.2.

Development versions such as 27.master.0 have no Evergreen counterpart, so their manifest is written with the default version 1.0.0 — the value the loader app and the updater already assume when no manifest is present — keeping their behavior unchanged. Always generating the file also means switching between LTS and development versions in the same out dir cannot leave a stale manifest behind.

Changes

  • Add //cobalt/build/cobalt_version.gni, which reads COBALT_VERSION from //cobalt/version.h via read_file() (no exec_script needed) and exposes cobalt_version.
  • Add cobalt/updater/version_manifest/generate_manifest.py (+ unit tests) that performs the version mapping and writes the manifest.
  • Hook a generate_<target>_manifest action into the Evergreen loaded content in modular_executable.gni so the file is part of the runtime_deps and gets packaged/deployed with the rest of the installation.

Verification

  • python3 -m unittest cobalt.updater.version_manifest.generate_manifest_test — 11/11 pass.
  • On main (27.master.0): //cobalt:generate_cobalt_manifest builds {"version": "1.0.0"} and app/cobalt/manifest.json is listed in cobalt_loader runtime_deps.
  • With COBALT_VERSION temporarily set to 27.lts.10 / 27.lts.11: builds {"version": "7.10.2"} / {"version": "7.11.2"}; switching back to 27.master.0 regenerates 1.0.0; a repeated build is a no-op.

Bug: 573320042
TAG=agy
CONV=cfbabc8d-e0a3-4bc7-84ca-97a280716915

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
Context State Description
CI / All Pass ✅ PASS All checks passed
CI / android ✅ PASS Passed
CI / evergreen ✅ PASS Passed
CI / linux ✅ PASS Passed
CI / tvos ✅ PASS Passed
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


evergreen: Generate truthful build-time manifest

Local Evergreen builds previously lacked a manifest.json, causing the
loader and updater to default to version 1.0.0 for the system image.
This resulted in local LTS builds being served production packages
with higher versions.

Generate manifest.json at build time with an Evergreen version derived
from COBALT_VERSION. LTS versions are mapped using the documented
major-offset scheme, while development versions retain the default
1.0.0 version to maintain existing behavior and prevent stale
manifests in shared output directories.

Bug: 573320042

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to automatically generate an Evergreen manifest.json file during the build process, mapping the Cobalt LTS version to its corresponding Evergreen version. It adds a GN helper to parse the Cobalt version, a Python script to perform the conversion and write the manifest, and corresponding unit tests. However, there is a critical issue in cobalt_version.gni where string_replace is called with four arguments, which is not supported in GN and will cause a build generation error.

Comment thread cobalt/build/cobalt_version.gni Resolved
Local Evergreen builds did not include a manifest.json under
app/<target>/, so both the loader app and the updater fell back to the
default Evergreen version 1.0.0 for the system image (slot 0). As a
result, a device running a local LTS build would be served any
production package whose version is greater than 1.0.0.

This change generates app/<target>/manifest.json at build time with the
Evergreen version derived from COBALT_VERSION, following the documented
mapping <MAJOR>.lts.<MINOR> -> <MAJOR - 20>.<MINOR>.2 (2 denotes the
"latest" release candidate). For example, 27.lts.10 maps to 7.10.2 and
27.lts.11 maps to 7.11.2.

Development versions such as 27.master.0 have no Evergreen counterpart,
so no manifest is generated for them and the existing behavior is
unchanged.

- Add //cobalt/build/cobalt_version.gni, which reads COBALT_VERSION from
  //cobalt/version.h via read_file() (no exec_script needed) and exposes
  `cobalt_version` and `cobalt_is_lts_version`.
- Add cobalt/updater/version_manifest/generate_manifest.py (+ unit test)
  that performs the version mapping and writes the manifest.
- Hook a generate_<target>_manifest action into the Evergreen loaded
  content in modular_executable.gni so the file is part of the
  runtime_deps and gets packaged/deployed with the rest of the
  installation.

Bug: 573320042
TAG=agy
CONV=cfbabc8d-e0a3-4bc7-84ca-97a280716915
Instead of skipping manifest generation for development versions such as
27.master.0, always generate app/<target>/manifest.json and write the
default Evergreen version 1.0.0 for versions without an Evergreen
counterpart. 1.0.0 is what the loader app and the updater already assume
when no manifest is present, so the behavior of development builds is
unchanged, and switching between LTS and development versions in the
same output directory can no longer leave a stale manifest behind.

Bug: 573320042
TAG=agy
CONV=cfbabc8d-e0a3-4bc7-84ca-97a280716915
Address review feedback by documenting why non-LTS Cobalt versions fall
back to the default Evergreen version.

Bug: 573320042
TAG=agy
CONV=cfbabc8d-e0a3-4bc7-84ca-97a280716915
@yuying-y
yuying-y enabled auto-merge (squash) October 21, 2026 00:10
@yuying-y
yuying-y force-pushed the evergreen_build_time_manifest branch from 1c74cdc to 733ffc4 Compare October 21, 2026 00:10
@yuying-y
yuying-y merged commit dd7a4d5 into youtube:main Oct 21, 2026
718 of 722 checks passed
briantting pushed a commit that referenced this pull request Oct 22, 2026
…fest.json

Refer to original PR: #13462

Local Evergreen builds did not include a `manifest.json` under
`app/<target>/`, so both the loader app and the updater fell back to the
default Evergreen version `1.0.0` for the system image (slot 0). As a
result, a device running a local LTS build would be served any
production package whose version is greater than `1.0.0`.

This change generates `app/<target>/manifest.json` at build time with
the Evergreen version derived from `COBALT_VERSION`, following the
documented mapping `<MAJOR>.lts.<MINOR>` → `<MAJOR - 20>.<MINOR>.2` (2
denotes the "latest" release candidate). For example, `27.lts.10` maps
to `7.10.2` and `27.lts.11` maps to `7.11.2`.

Development versions such as `27.master.0` have no Evergreen
counterpart, so their manifest is written with the default version
`1.0.0` — the value the loader app and the updater already assume when
no manifest is present — keeping their behavior unchanged. Always
generating the file also means switching between LTS and development
versions in the same out dir cannot leave a stale manifest behind.

### Changes
- Add `//cobalt/build/cobalt_version.gni`, which reads `COBALT_VERSION`
from `//cobalt/version.h` via `read_file()` (no `exec_script` needed)
and exposes `cobalt_version`.
- Add `cobalt/updater/version_manifest/generate_manifest.py` (+ unit
tests) that performs the version mapping and writes the manifest.
- Hook a `generate_<target>_manifest` action into the Evergreen loaded
content in `modular_executable.gni` so the file is part of the
`runtime_deps` and gets packaged/deployed with the rest of the
installation.

### Verification
- `python3 -m unittest
cobalt.updater.version_manifest.generate_manifest_test` — 11/11 pass.
- On `main` (`27.master.0`): `//cobalt:generate_cobalt_manifest` builds
`{"version": "1.0.0"}` and `app/cobalt/manifest.json` is listed in
`cobalt_loader` `runtime_deps`.
- With `COBALT_VERSION` temporarily set to `27.lts.10` / `27.lts.11`:
builds `{"version": "7.10.2"}` / `{"version": "7.11.2"}`; switching back
to `27.master.0` regenerates `1.0.0`; a repeated build is a no-op.

Bug: 573320042
TAG=agy
CONV=cfbabc8d-e0a3-4bc7-84ca-97a280716915

(cherry picked from commit dd7a4d5)
briantting pushed a commit that referenced this pull request Oct 26, 2026
…fest.json

Refer to original PR: #13462

Local Evergreen builds did not include a `manifest.json` under
`app/<target>/`, so both the loader app and the updater fell back to the
default Evergreen version `1.0.0` for the system image (slot 0). As a
result, a device running a local LTS build would be served any
production package whose version is greater than `1.0.0`.

This change generates `app/<target>/manifest.json` at build time with
the Evergreen version derived from `COBALT_VERSION`, following the
documented mapping `<MAJOR>.lts.<MINOR>` → `<MAJOR - 20>.<MINOR>.2` (2
denotes the "latest" release candidate). For example, `27.lts.10` maps
to `7.10.2` and `27.lts.11` maps to `7.11.2`.

Development versions such as `27.master.0` have no Evergreen
counterpart, so their manifest is written with the default version
`1.0.0` — the value the loader app and the updater already assume when
no manifest is present — keeping their behavior unchanged. Always
generating the file also means switching between LTS and development
versions in the same out dir cannot leave a stale manifest behind.

### Changes
- Add `//cobalt/build/cobalt_version.gni`, which reads `COBALT_VERSION`
from `//cobalt/version.h` via `read_file()` (no `exec_script` needed)
and exposes `cobalt_version`.
- Add `cobalt/updater/version_manifest/generate_manifest.py` (+ unit
tests) that performs the version mapping and writes the manifest.
- Hook a `generate_<target>_manifest` action into the Evergreen loaded
content in `modular_executable.gni` so the file is part of the
`runtime_deps` and gets packaged/deployed with the rest of the
installation.

### Verification
- `python3 -m unittest
cobalt.updater.version_manifest.generate_manifest_test` — 11/11 pass.
- On `main` (`27.master.0`): `//cobalt:generate_cobalt_manifest` builds
`{"version": "1.0.0"}` and `app/cobalt/manifest.json` is listed in
`cobalt_loader` `runtime_deps`.
- With `COBALT_VERSION` temporarily set to `27.lts.10` / `27.lts.11`:
builds `{"version": "7.10.2"}` / `{"version": "7.11.2"}`; switching back
to `27.master.0` regenerates `1.0.0`; a repeated build is a no-op.

Bug: 573320042
TAG=agy
CONV=cfbabc8d-e0a3-4bc7-84ca-97a280716915

(cherry picked from commit dd7a4d5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants