feat(containers): add support for handling images that link to the CF registry#9596
feat(containers): add support for handling images that link to the CF registry#9596CarmenPopoviciu merged 4 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: de266da The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
| if (!isCloudflareRegistryLink(options.image)) { | ||
| throw new Error( | ||
| `Image ${options.image} is a registry link but does not point to the Cloudflare container registry.\n` + | ||
| `All images must use ${getCloudflareContainerRegistry()}, which is the default registry for Wrangler. To use an existing image from another repository, see https://developers.cloudflare.com/containers/image-management/#using-existing-images` |
There was a problem hiding this comment.
@mikenomitch is this the correct url I'm using here?
| * (defined as per `getCloudflareContainerRegistry` above) | ||
| */ | ||
| export function isCloudflareRegistryLink(image: string) { | ||
| const cfRegistry = getCloudflareContainerRegistry(); |
There was a problem hiding this comment.
This will create a new string everytime it gets executed. Using something like this and definining cfRegistry in global scope will remove the unnecessary string allocation.
| const cfRegistry = getCloudflareContainerRegistry(); | |
| cfRegistry ??= getCloudflareContainerRegistry(); |
32412fd to
cd4ae0e
Compare
72862dd to
26fc672
Compare
2c3ab13 to
53508df
Compare
26fc672 to
c95089e
Compare
6a865db to
fec57e7
Compare
c95089e to
41b9899
Compare
| if (output === "0" && process.platform !== "linux") { | ||
| throw new Error( | ||
| `The container "${imageTag.replace(MF_DEV_CONTAINER_PREFIX + "/", "")}" does not expose any ports.\n` + | ||
| "To develop containers locally on non-Linux platforms, you must expose any ports that you call with `getTCPPort()` in your Dockerfile." |
There was a problem hiding this comment.
Could we link to the dockerfile EXPOSE docs here?
There was a problem hiding this comment.
linking to external docs feels a bit weird, and they come up if you just search expose ports dockerfile. but happy to if you feel strongly about it.
There was a problem hiding this comment.
Can we add a section in our docs about this?
There was a problem hiding this comment.
i think @mikenomitch was going to do that already :) - i'll add a ticket to link to those docs when they're up
| (c) => !isDockerfile(c.image ?? c.configuration.image) | ||
| ); | ||
| if (needsPulling && !resolved.dev.remote) { | ||
| await fillOpenAPIConfiguration(config, isNonInteractiveOrCI()); |
There was a problem hiding this comment.
Does this pull in auth at all? ConfigController has an auth hook that we should use
There was a problem hiding this comment.
talked about this offline, will leave sorting out containers auth out of this PR.
ba43bc1 to
7e4fac7
Compare
7e4fac7 to
de266da
Compare
|
Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the Depending on your changes, running Notes:
|
|
tracking testing followup in DEVX-1980 |
…seba/containers_scope_debug * 'main' of ssh://github.com/cloudflare/workers-sdk: Version Packages (cloudflare#9697) add remote bindings support to `getPlatformProxy` (cloudflare#9688) feat(containers): add support for handling images that link to the CF registry (cloudflare#9596) CC-5418: Set instance_type in wrangler (cloudflare#9633) remove warnings during config validations on `experimental_remote` fields (cloudflare#9678) add debug logs for workerd (cloudflare#9640) `wrangler containers apply` uses `observability` configuration (cloudflare#9558) Version Packages (cloudflare#9658) Temporarily skip Openapi C3 e2e tests (cloudflare#9691) Skip authed fixture on forks (cloudflare#9681)
…seba/containers_scope * 'main' of ssh://github.com/cloudflare/workers-sdk: Add CLAUDE.md for Claude Code guidance (cloudflare#9563) Version Packages (cloudflare#9697) add remote bindings support to `getPlatformProxy` (cloudflare#9688) feat(containers): add support for handling images that link to the CF registry (cloudflare#9596) CC-5418: Set instance_type in wrangler (cloudflare#9633) remove warnings during config validations on `experimental_remote` fields (cloudflare#9678) add debug logs for workerd (cloudflare#9640) `wrangler containers apply` uses `observability` configuration (cloudflare#9558) Version Packages (cloudflare#9658) Temporarily skip Openapi C3 e2e tests (cloudflare#9691) Skip authed fixture on forks (cloudflare#9681)
| if (!isCloudflareRegistryLink(options.image)) { | ||
| throw new Error( | ||
| `Image "${options.image}" is a registry link but does not point to the Cloudflare container registry.\n` + | ||
| `To use an existing image from another repository, see https://developers.cloudflare.com/containers/image-management/#using-existing-images` |
Fixes DEVX-1966.
the first commit adds the pulling functionality, the second just makes manual testing a bit easier. e2e testing will happen in a followup.