Skip to content

Update buildAndMaybePush to use more robust method to find local digests #9641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 24, 2025

Conversation

IRCody
Copy link
Contributor

@IRCody IRCody commented Jun 17, 2025

Older versions of docker sometimes will report the digest as "" which would break with the previous implementation. This implementation should correctly grab the values.

Fixes #[insert GH or internal issue link(s)].

Describe your change...


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • Wrangler / Vite E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: Modifying existing behavior that is not e2e tested afaik
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Makes existing method more robust but doesn't change user ux
  • Wrangler V3 Backport
    • TODO (before merge)
    • Wrangler PR:
    • Not necessary because: feature doesn't exist in v3

Copy link

changeset-bot bot commented Jun 17, 2025

🦋 Changeset detected

Latest commit: 0bf5624

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers Patch

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

Copy link

pkg-pr-new bot commented Jun 17, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@9641

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@9641

miniflare

npm i https://pkg.pr.new/miniflare@9641

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@9641

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@9641

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@9641

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@9641

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@9641

wrangler

npm i https://pkg.pr.new/wrangler@9641

commit: 0bf5624

@IRCody IRCody force-pushed the cdr/docker-inspect branch 8 times, most recently from b550b1c to 22ed63b Compare June 18, 2025 20:51
Older versions of docker sometimes will report the digest as "<none>"
which would break with the previous implementation. This implementation
should correctly grab the values.
@IRCody IRCody force-pushed the cdr/docker-inspect branch from 22ed63b to 40c3372 Compare June 18, 2025 21:03
@IRCody IRCody marked this pull request as ready for review June 18, 2025 21:05
@IRCody IRCody requested review from a team as code owners June 18, 2025 21:05
@CarmenPopoviciu
Copy link
Contributor

left a few nit comments, but LGTM otherwise.

IRCody added 3 commits June 24, 2025 06:51
Fixes an issue where the user could get into a state where the image has
been pushed but the container fails to update it's configuration. On the
next push container.configuration.image will not be set and
container.image is deleted leading to failures when trying to update the
container app.
Copy link
Contributor

Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the v3-maintenance branch with your changes. Thank you for helping us keep Wrangler v3 supported!

Depending on your changes, running git rebase --onto v3-maintenance main cdr/docker-inspect might be a good starting point.

Notes:

  • your PR branch should be named v3-backport-9641
  • add the skip-v3-pr label to the current PR to stop this workflow from failing

@IRCody IRCody added the skip-v3-pr Skip validation of presence of a v3 backport PR label Jun 24, 2025
Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with this part of the codebase, but the code looks good to me 🙂

(I am also trusting Carmen's comment #9641 (comment))

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jun 24, 2025
Copy link
Contributor

@CarmenPopoviciu CarmenPopoviciu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for addressing all my comment @IRCody ♥️

@@ -18,14 +18,17 @@ export async function maybeBuildContainer(
imageTag: string,
dryRun: boolean,
pathToDocker: string
) {
): Promise<{ image: string; pushed: boolean }> {
try {
if (
!isDockerfile(
containerConfig.image ?? containerConfig.configuration?.image
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

containerConfig.image has type string so the ?? isn't necessary

Suggested change
containerConfig.image ?? containerConfig.configuration?.image
containerConfig.image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this should it be:
`containerconfig.image === "" ? containerConfig.configuration?.image : containerConfig.image;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like containerConfig.image === "" throws a validation error, so that shouldn't be possible by the time we get here.

also yeah the nullish coalescing thingy should be unnecessary anymore, that was me earlier today 😅
we should have a diff type for wrangler config and the api (since one expects containers.image and one containers.configuration.image 🫠 ) to make this sort of thing clearer, but we'll follow up on that later.

@emily-shen emily-shen added this pull request to the merge queue Jun 24, 2025
Merged via the queue into main with commit fdbc9f6 Jun 24, 2025
50 of 53 checks passed
@emily-shen emily-shen deleted the cdr/docker-inspect branch June 24, 2025 20:05
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-v3-pr Skip validation of presence of a v3 backport PR
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants