feat(build): add BROWSEROS_SKIP_R2_DOWNLOAD escape hatch for external builds#999
Open
Aarjav Jain (A2rjav) wants to merge 1 commit into
Open
Conversation
… builds Closes browseros-ai#792 The download_resources build module hard-failed validation when R2 credentials were missing, blocking external contributors who don't have access to the private bucket from running a local Chromium build at all. - Add EnvConfig.skip_r2_download property reading BROWSEROS_SKIP_R2_DOWNLOAD (accepts 1 / true / yes / on, case-insensitive) - DownloadResourcesModule.validate() returns early when the flag is set, bypassing the boto3 and R2-config checks - DownloadResourcesModule.execute() logs a clear warning and short-circuits before any R2 calls, so the build proceeds with whatever is cached locally - Improve the existing "R2 configuration not set" error to point external contributors at the new flag - Add unit tests covering both the validation bypass and the execute-time short-circuit (mocking log_warning so the test is portable across hosts whose console encoding can't render the warning emoji) - Document the flag in CONTRIBUTING.md with PowerShell and POSIX examples and a clear caveat about copy_resources steps that still depend on the cached binaries
Contributor
|
PR author is not in the allowed authors list. |
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
Closes #792
The
download_resourcesbuild module hard-failed validation when R2 credentials were missing, blocking external contributors from running a local Chromium build. The maintainer noted in #792 that the R2 bucket is for internal build infra and not actually required for a local build — but until now there was no documented or supported way to skip it.This PR adds a documented escape hatch: set
BROWSEROS_SKIP_R2_DOWNLOAD=1and thedownload_resourcesstep short-circuits cleanly.Changes
Code
packages/browseros/build/common/env.py— addsEnvConfig.skip_r2_downloadproperty. ReadsBROWSEROS_SKIP_R2_DOWNLOADand accepts1/true/yes/on(case-insensitive, trimmed).packages/browseros/build/modules/storage/download.pyvalidate()returns early when the flag is set, bypassing both theboto3import check and the R2 config check.execute()logs a clearlog_warningand returns before any R2 call."R2 configuration not set"ValidationError now points users at the new flag, so contributors who hit the error see the workaround immediately.Tests —
packages/browseros/build/modules/storage/download_test.pytest_validate_skips_all_checks_when_flag_set— validates withhas_r2_config()returningFalse, must not raise.test_validate_still_requires_r2_when_flag_unset— flag off, missing creds → still raisesValidationError(no regression).test_execute_returns_early_when_flag_set— assertsget_r2_clientis never invoked and a warning is emitted.log_warningis mocked so the test is portable across hosts whose console encoding can't render the warning emoji (e.g. Windows CP1252).Docs —
CONTRIBUTING.mdgets a new "Building Without R2 Credentials (External Contributors)" section under Browser Development with POSIX + PowerShell examples and an explicit caveat thatcopy_resourcesmay still need a populatedresources/binaries/browseros_server/cache for a full build.Test plan
python -m unittest build.modules.storage.download_test -v— all 7 tests pass (4 existing + 3 new)EnvConfig.skip_r2_downloadsmoke test across 9 input values (1,true,TRUE,yes,on,0,false,""," 1 ") — all produce expected booleans.env:BROWSEROS_SKIP_R2_DOWNLOAD=1 python build/build.py --config build/config/debug.<os>.yaml --chromium-src ... --buildshould reach the configure/build steps without failing atdownload_resources