Repository navigation
fix(wb): deploy Durable Object-managed containers alongside reusable images - #1635
Conversation
…images 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 enables the deployment of containers using the Durable Object scheduling policy by relaxing the requirement for an application-wide 'image' field in the configuration. It introduces a schema update to support named images and enforces strict build context validation to ensure that only committed sources are used for these deployments, aligning with the project's existing deployment safety standards. 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. Containers managed by the DO, No image field for them to show. We check the git status, To avoid any hiatus, And let the deployment flow. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for Durable Object-managed containers by updating the container schema to allow optional image fields and introducing an images record for named images. It also adds validation to ensure that build contexts for these named images are committed in git before deployment. The review feedback suggests removing an explanatory comment that violates the repository's style guide on redundant comments, and optimizing the git assertion loop by running the checks in parallel using Promise.all.
| for (const container of containers) { | ||
| for (const image of Object.values(container.images ?? {})) { | ||
| if (image.dockerfile) | ||
| await assertCommittedNamedImageSource(configDir, image.dockerfile, image.build_context, run); | ||
| } | ||
| } |
There was a problem hiding this comment.
Since assertCommittedNamedImageSource performs I/O-bound git operations, running these assertions sequentially in a nested loop can be slow if there are multiple containers or images. We can run them in parallel using Promise.all to improve deployment performance.
const assertions: Promise<void>[] = [];
for (const container of containers) {
for (const image of Object.values(container.images ?? {})) {
if (image.dockerfile) {
assertions.push(assertCommittedNamedImageSource(configDir, image.dockerfile, image.build_context, run));
}
}
}
await Promise.all(assertions);There was a problem hiding this comment.
A configuration names one or two images in practice, so the check runs a handful of short git commands before a deploy that builds and uploads container images. Running them in parallel would not change the deploy time noticeably, and the sequential loop stops at the first dirty context with a single clear error. Keeping it sequential.
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Why
wb deploy --containers-rollout=gradual|immediatevalidates every Wrangler container entry with a schema that requiresimage. A container that uses the Durable Object scheduling policy has no application-wideimage; it names its images underimages(for exampleimages.app.dockerfile). Deploying such a configuration fails before anything is built:Requirements
imagekeep reusing published images built from committed Git contexts (existing contract)wbpasses Durable Object-managed containers to Wrangler unchanged, and Wrangler builds their images, because a named registry image must be a digest-pinned reference and the registry listingwbuses exposes tags onlywbrejects uncommitted or untracked files in the build context of each named Dockerfile image, so that these images, like the reused ones, contain committed sources onlyCustomer Summary
Projects can deploy Containers that use the Durable Object scheduling policy with
wb deploy --containers-rollout=gradualorimmediate.Technical Summary
packages/wb/src/utils/containerImages.tsimageoptional and acceptsimages(named images with an optionaldockerfileandbuild_context).imagepoints to a local Dockerfile go through image reuse, as before.dockerfile,git status --porcelain --untracked-files=allover its build context must be empty; otherwise the deploy stops with the existing "Commit container build context changes before deploying" error.Testing
bun run verifybun test test/unit/containerImages.test.tsinpackages/wb(26 tests). Two new tests:imageis required again.Notes