Skip to content

Add support for BUILD-available secrets for Local Builds#10229

Merged
falahat merged 9 commits intonextfrom
zip_deploy_secrets
Apr 16, 2026
Merged

Add support for BUILD-available secrets for Local Builds#10229
falahat merged 9 commits intonextfrom
zip_deploy_secrets

Conversation

@falahat
Copy link
Copy Markdown
Contributor

@falahat falahat commented Mar 31, 2026

Description

This adds support for build secrets for Local Builds. This will look up the secrets from GCP and inject the raw value as an env var into the Local Build process.

Scenarios Tested

Created a local build app with secrets on a static page and built it and deployed to staging successfully.
I verified the secret value showed up on the page as expected.

Copy link
Copy Markdown
Contributor

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

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 implements secret resolution for local builds in App Hosting by refactoring the loadSecret utility into a shared module and updating the localBuild function to fetch secrets from Google Secret Manager. The changes ensure that only environment variables with "BUILD" availability are injected into the process during the build phase. Feedback was provided to optimize the secret resolution logic by parallelizing the loadSecret calls using Promise.all to improve performance when multiple secrets are defined.

Comment thread src/apphosting/localbuilds.ts Outdated
@falahat
Copy link
Copy Markdown
Contributor Author

falahat commented Apr 1, 2026

/gemini review

Copy link
Copy Markdown
Contributor

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

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 implements secret resolution for local builds in App Hosting. It introduces a loadSecret utility to fetch plaintext values from Secret Manager, supporting both full resource names and shorthand syntax. The localBuild function now resolves environment variables marked for the BUILD phase and ensures they are cleaned up after the process completes. Additionally, the emulator was refactored to use this shared secret loading logic. Review feedback suggests parallelizing secret resolution to improve performance and using existing error-handling utilities to avoid the use of the any type, in accordance with the repository style guide.

Comment thread src/apphosting/localbuilds.ts Outdated
Comment thread src/apphosting/secrets/index.ts
@falahat
Copy link
Copy Markdown
Contributor Author

falahat commented Apr 1, 2026

/gemini review

Copy link
Copy Markdown
Contributor

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

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 implements secret resolution for App Hosting local builds. It introduces a centralized loadSecret utility in src/apphosting/secrets/index.ts that handles both fully qualified resource names and shorthand secret formats. The localBuild function has been updated to asynchronously resolve and inject BUILD-available secrets into the environment while correctly ignoring RUNTIME-only secrets. Feedback was provided to replace the use of the any type in error handling with a more type-safe approach using unknown and existing utilities, as per the repository's style guide.

Comment thread src/apphosting/secrets/index.ts
@falahat falahat marked this pull request as ready for review April 1, 2026 16:11
@falahat falahat requested review from Yuangwang and annajowang April 1, 2026 16:11
@falahat falahat changed the base branch from main to next April 15, 2026 20:38
@falahat falahat changed the base branch from next to main April 15, 2026 20:39
@falahat falahat changed the base branch from main to next April 16, 2026 13:34
@falahat falahat merged commit 4349832 into next Apr 16, 2026
5 checks passed
@falahat falahat deleted the zip_deploy_secrets branch April 16, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants