Preserve verified WebRTC object cache across gclient synchronization
android-ci / android-arm64 (push) Failing after 11m18s
android-ci / android-arm64 (push) Failing after 11m18s
This commit is contained in:
1 parent
e676f2ad04
commit
4f38a7e011
5 files changed
+61
-1
No files matched your search
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Undo only receipt-matched source patches before gclient reuses a CI checkpoint."""
|
||||
import json
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
||||
|
||||
def unpatch(checkout, diffs):
|
||||
checkout = checkout.resolve(strict=True)
|
||||
pending = []
|
||||
for relative, expected in diffs.items():
|
||||
parts = pathlib.PurePosixPath(relative)
|
||||
if parts.is_absolute() or '..' in parts.parts or not parts.parts or parts.parts[0] != 'src':
|
||||
raise ValueError('Unconfined dependency receipt path')
|
||||
directory = checkout.joinpath(*parts.parts).resolve(strict=True)
|
||||
if not directory.is_relative_to(checkout):
|
||||
raise ValueError('Dependency checkout escapes cache')
|
||||
actual = subprocess.check_output(['git', '-C', str(directory), 'diff', '--binary', 'HEAD', '--'])
|
||||
encoded = expected.encode('utf-8')
|
||||
if actual != encoded:
|
||||
raise ValueError(f'Cached changes differ from verified receipt: {relative}; refusing to reset')
|
||||
if actual:
|
||||
subprocess.run(['git', '-C', str(directory), 'apply', '--reverse', '--check', '-'], input=actual, check=True)
|
||||
pending.append((directory, actual))
|
||||
# Validate every repository before making any mutation. Untracked outputs are not touched.
|
||||
for directory, patch in pending:
|
||||
subprocess.run(['git', '-C', str(directory), 'apply', '--reverse', '-'], input=patch, check=True)
|
||||
print(f'Removed {len(pending)} receipt-matched source patches; build objects retained', flush=True)
|
||||
|
||||
|
||||
def main():
|
||||
base = pathlib.Path('target/native-deps/aarch64-linux-android')
|
||||
receipt_path = base / 'provenance.json'
|
||||
if not receipt_path.exists():
|
||||
print('No restored dependency receipt; fresh provisioning')
|
||||
return
|
||||
receipt = json.loads(receipt_path.read_text(encoding='utf-8'))
|
||||
lock = json.loads(pathlib.Path('native/native-deps.lock.json').read_text(encoding='utf-8'))
|
||||
if receipt['target'] != 'aarch64-linux-android':
|
||||
raise ValueError('Wrong cached target')
|
||||
for receipt_key, lock_key in [('webrtc_revision', 'webrtc'), ('sdk_revision', 'sdk'), ('depot_tools_revision', 'depot_tools')]:
|
||||
if receipt[receipt_key] != lock[lock_key]['revision']:
|
||||
raise ValueError('Cached source revision no longer matches policy')
|
||||
unpatch(base / 'checkout', receipt['applied_source_diffs'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -140,7 +140,10 @@ jobs:
|
||||
- name: Build pinned WebRTC dependencies with bounded CI parallelism
|
||||
if: ${{ github.event.inputs.mode != 'inventory' }}
|
||||
id: dependencies
|
||||
run: cargo run --locked -p xtask -- deps --target "$TARGET" --llvm-dir "$LLVM_HOME" --jobs "$CARGO_BUILD_JOBS"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 .gitea/prepare-android-dependency-cache.py
|
||||
cargo run --locked -p xtask -- deps --target "$TARGET" --llvm-dir "$LLVM_HOME" --jobs "$CARGO_BUILD_JOBS"
|
||||
|
||||
- name: Checkpoint verified WebRTC before application build
|
||||
if: ${{ success() && github.event.inputs.mode != 'inventory' && steps.webrtc-cache.outputs.cache-hit != 'true' }}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
Added checksum-pinned SDK/NDK/Rust/Skia/Gradle provisioning, early disk/RAM gates, four-job CI compilation,
|
||||
dependency checkpoints before native build, memory evidence and SHA-labelled test APK artifacts;
|
||||
no automatic releases, production signing or device actions. Local Windows limits remain separate.
|
||||
- Fixed restored Android WebRTC checkpoints: validate and reverse receipt-matched source patches
|
||||
before gclient synchronization, then reapply pinned patches without deleting compiled objects.
|
||||
|
||||
- Android onboarding is now a full-screen page with a one-line 48dp nickname field, visible theme
|
||||
choices, errors and Create/Cancel buttons; keyboard insets are handled before profile creation.
|
||||
|
||||
@@ -124,6 +124,9 @@ checkouts and Ninja objects. Its key excludes completed build receipts but inclu
|
||||
tool pins and dependency drivers; there is no cross-policy fallback. Every cache hit still runs
|
||||
`xtask deps`: checkouts, patches, GN inputs and artifacts are checked and current provenance is
|
||||
regenerated before use. The repository lock is never overwritten by a cached copy.
|
||||
Before gclient sync, CI reverses only source diffs byte-identical to the restored provenance receipt;
|
||||
unexpected modifications fail closed. Pinned patches are then reapplied by xtask. No reset/clean of
|
||||
cached source or object outputs is used.
|
||||
These potentially large checkpoints require runner cache storage/capacity; cache misses remain valid
|
||||
cold builds. Before/after cgroup counters and `/usr/bin/time -v` data are retained as a separate
|
||||
`android-build-resources-<SHA>` artifact even when native compilation fails, to diagnose SIGKILL
|
||||
|
||||
@@ -81,6 +81,10 @@ Updated **2026-11-11**. Windows baseline remains `05e8d34bcf0e24a44f76e65220293c
|
||||
overrides into CI. SSH/admin connection is not configured; no host change via mounted Docker socket
|
||||
attempted. Resume with the same4-job configuration and caches on owner's instruction; no memory
|
||||
expansion, optimization override or new infrastructure investigation is required by these pauses.
|
||||
- Run4855 (`e676f2a`) restored both caches but gclient refused pre-existing pinned libunwind changes
|
||||
in src/buildtools. Added CI-only pre-sync receipt-bound reversal of exact applied_source_diffs;
|
||||
unexpected modifications abort, object files retained, xtask reapplies pinned patches afterward.
|
||||
Real temporary Git fixture passed reversal/output-retention and mismatch-rejection checks.
|
||||
|
||||
## First Android APK build
|
||||
|
||||
|
||||
Reference in new issue
Block a user