Create a basic implementation of local builds #10066
Conversation
…tive API fields. Also, this code keeps the source deploy path (existing feature, different from local builds) unaffected. We create tar.gz files instead of zip files.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces the initial framework for supporting local builds within App Hosting. It enables the system to process and deploy applications that have been built locally, using Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a basic implementation for local builds in App Hosting, differentiating between local builds (using .tar.gz archives) and standard source deploys (using .zip). However, a high-severity path traversal vulnerability was identified in the createTarArchive function, which could lead to the exfiltration of sensitive files due to unvalidated user-supplied directory paths. Additionally, the implementation could benefit from improved type safety by removing any types and enhanced maintainability by addressing code duplication.
src/deploy/apphosting/deploy.spec.ts
Outdated
| bucket: bucketName, | ||
| object: "foo-local-build-1234.tar.gz", | ||
| }); | ||
| createReadStreamStub.returns("stream" as any); |
There was a problem hiding this comment.
Using as any is an escape hatch that goes against the repository's style guide. Please try to use a more specific type or a mock object that conforms to the fs.ReadStream interface.
References
- Line 38: Never use
anyorunknownas an escape hatch. Define proper interfaces/types or use type guards. (link)
|
|
||
| beforeEach(() => { | ||
| isEnabledStub = sinon.stub(experiments, "isEnabled").returns(false); | ||
| getBackendStub = sinon.stub(backend, "getBackend").resolves({ uri: "https://foo-us-central1.a.run.app" } as any); |
There was a problem hiding this comment.
Using as any is an escape hatch that goes against the repository's style guide. The getBackend function is expected to return a Backend object. Please provide a mock that conforms to the Backend interface from ../../gcp/apphosting, even if it's a partial mock with the necessary properties for the test.
References
- Line 38: Never use
anyorunknownas an escape hatch. Define proper interfaces/types or use type guards. (link)
…tinglocalbuilds flag is not enabled. Also make the createTarArchive implementation closer to the one from the zip-deploy branch
…e apphostinglocalbuilds flag is not enabled." This reverts commit 25acd9b.
… on the zip-deploy branch
…de more clear about skipping local builds when the experiment flag is not enabled.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
This is based off of Joanna's Draft PR: #9506
Also see #9193 for an earlier partial implementation of local builds.
Description
This uses the new effective API fields. Also, this code keeps the source deploy path (existing feature, different from local builds) unaffected.
We create tar.gz files instead of zip files.
Scenarios Tested
TODO: Verify local builds works (basic, no env vars)
TODO: Verify that source deploy is unaffected and still works as expected
Sample Commands
TODO: Local build command
TODO: Source deploy command