Accept service-account-json in the CAS config flags - #3252
Open
frankfeng579 wants to merge 1 commit into
Open
frankfeng579 wants to merge 1 commit into
frankfeng579 wants to merge 1 commit into
Conversation
Allow "service-account-json" in the "flags" section of the CAS downloader config (/etc/casdownloader/config.json by default). It was previously ignored as an auto-populated flag. When set, cvd passes it to casdownloader instead of -use-adc. This lets hosts authenticate casdownloader without depending on GOOGLE_APPLICATION_CREDENTIALS reaching cvd, e.g. when cvd is run by the host orchestrator, whose environment is controlled by its init script. The configured key is only used by casdownloader for CAS; Android Build API credentials are unaffected. Credential precedence: service-account-json from the config, which is specific to CAS; then the existing reuse of the Android Build API service account (--service_account_filepath), which may not have CAS access and is logged as a warning when used; then application default credentials. casdownloader requires exactly one credential flag, so the config value is removed from the pass-through flags and emitted by the credential selection. A configured key that does not exist is an error, which disables CAS with a clear reason rather than falling back to other credentials. Assisted-by: Jetski:Claude
jemoreira
approved these changes
Sep 28, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow
service-account-jsonin theflagssection of the CAS downloaderconfig (
/etc/casdownloader/config.jsonby default). When set, cvd passes itto casdownloader instead of
-use-adc. Previously this key was silently ignoredas an auto-populated flag.
This lets hosts authenticate casdownloader without relying on
GOOGLE_APPLICATION_CREDENTIALSreaching cvd, e.g. when cvd is launched bythe host orchestrator. The key is used only for CAS; Android Build API
credentials are unaffected.
Credential precedence
flags.service-account-jsonfrom the CAS config (CAS-specific).--service_account_filepath(existing reuse of the Build API key, which maynot have CAS access; now logged as a warning when used).
-use-adc).Exactly one credential flag is passed, as casdownloader requires. A configured
key that doesn't exist disables CAS with a clear error instead of silently
falling back; downloads then proceed from Android Build as before.
Testing
cas_downloader_test.cpp: key from config, configoverrides
--service_account_filepath, missing configured key disables CAS.bazel test //cuttlefish/host/libs/web/cas/...passes.cvd fetchof agit_mainphone build:-use-adc, image downloaded from CAS;-service-account-json=<key>, image downloaded from CAS;completed via Android Build.