[fuchsia] Guard against empty manifest.json in update_sdk.py
In some infra builds, we have observed an empty manifest.json file. This is unexpected, and it's unclear where the empty file stems from. It's potentially a problem during checkout, but could also be incorrect cleanup in between infrastructure runs. Regardless, we can guard against the condition and gracefully recover when this happens. This will cause a wipe of the SDK directory and refetch, which is the correct way to recover from an unknown SDK checkout state. Change-Id: I9bf89840039cdded5f82b83c4900d2fc032833b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6178605 Reviewed-by: David Song <wintermelons@google.com> Reviewed-by: Zijie He <zijiehe@google.com> Commit-Queue: Aaron Knobloch <aknobloch@google.com> Cr-Commit-Position: refs/heads/main@{#1407642}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
94cec7b222
commit
1445166166
@ -58,7 +58,11 @@ def _GetCurrentVersionFromManifest() -> Optional[str]:
|
||||
if not os.path.exists(_VERSION_FILE):
|
||||
return None
|
||||
with open(_VERSION_FILE) as f:
|
||||
return json.load(f)['id']
|
||||
data = json.load(f)
|
||||
if not data:
|
||||
logging.warning('Unexpected empty manifest.json file.')
|
||||
return None
|
||||
return data['id']
|
||||
|
||||
|
||||
def main():
|
||||
|
Reference in New Issue
Block a user