Repository navigation
fix(wb): build Durable Object-managed images from committed sources only - #1636
Conversation
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
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 improves the reliability and security of the deployment process for Durable Object-managed container images. By switching to an extraction-based build approach using git archive, the system ensures that the build context is strictly limited to committed sources. This change eliminates the risk of including local environment variables or untracked files in the final image, ensuring consistent builds across different environments. Highlights
New Features🧠 You can now enable Memory (public preview) 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. 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 the 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 counterproductive. 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. The code was loose, the files were stray, Local secrets slipped away. Now git archive locks the gate, Committed source defines our fate. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors container image handling to ensure that Wrangler builds Durable Object-managed images exclusively from committed sources. This is achieved by extracting the committed git tree of the build context into a temporary directory before deployment. A review comment points out a violation of the style guide, suggesting the removal of redundant path-separator normalization since the codebase only targets macOS and Linux.
…context Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Why
For containers that name their images under
images(Durable Object scheduling policy), Wrangler builds the image itself.wb deploypointed Wrangler at the working tree, and only checkedgit statusfor the build context, which does not report git-ignored files. Ignored local files (for example.env) inside the build context could therefore be sent to the Docker build and end up in the deployed image. Single-image containers (image) already build from agit archiveextraction and were not affected.Requirements
git archivepath as single-image containers and makes untracked and ignored files unreachable instead of trying to detect themCustomer Summary
wb deploy --containers-rollout=gradual|immediatenow deploys Durable Object-managed container images built only from committed files. Untracked or git-ignored files in the build context no longer block the deploy and are never included in the image.Technical Summary
packages/wb/src/utils/containerImages.ts: eachimagesentry with adockerfileis extracted withgit archiveinto the temporary directory, and itsdockerfileandbuild_contextin the temporary Wrangler config are rewritten to that copy. The sourcewrangler.jsonis not modified.Testing
bun wb test packages/wb/test/unit/containerImages.test.ts(26 pass): a named image deploy with an ignored.envand an untracked file in its context hands Wrangler a context containing only the committedDockerfile, leaveswrangler.jsonunchanged, and a tracked edit to that context is rejected.bun run verify