GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — build: fix localstate for remote context and stdin by crazy-max · Pull Request #2560 · docker/buildx

Conversation

@crazy-max

@crazy-max crazy-max commented Jun 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

relates to #1735
needs or closes #2561

When using a remote context or stdin the LocalPath and DockerfilePath are not correct:

$ docker buildx buildx https://github.com/docker/buildx.git
...
#14 exporting to image
#14 exporting layers done
#14 writing image sha256:d9015ff8b549fee9b8b8100cd168efea32015136c1a0a463dd5f696e130e72fa done
#14 DONE 0.0s

View build details: docker-desktop://dashboard/build/default/default/aav2ix4nw5eky66fw045dkylr

$ jq . ~/.docker/buildx/refs/default/default/aav2ix4nw5eky66fw045dkylr
{
  "Target": "default",
  "LocalPath": "/home/crazy/foo/bar/https:/github.com/docker/buildx.git",
  "DockerfilePath": ""
}
$ docker buildx build -f hello.Dockerfile https://github.com/docker/actions-toolkit.git#:__tests__/fixtures
...
#10 exporting to image
#10 exporting layers done
#10 writing image sha256:9deae3ebca280147d5096bd8858e2a008014cd6cc2e7b33e6307f06cbf11d992 done
#10 DONE 0.0s

View build details: docker-desktop://dashboard/build/default/default/7pnnqpgacnqq98oa1a1h5sz6t

$ jq . ~/.docker/buildx/refs/default/default/7pnnqpgacnqq98oa1a1h5sz6t
{
  "Target": "default",
  "LocalPath": "/home/crazy/foo/bar/https:/github.com/docker/actions-toolkit.git#:__tests__/fixtures",
  "DockerfilePath": "/home/crazy/foo/bar/hello.Dockerfile"
}
$ docker buildx build -f- . < hello.Dockerfile
...
#14 exporting to image
#14 exporting layers done
#14 writing image sha256:d9015ff8b549fee9b8b8100cd168efea32015136c1a0a463dd5f696e130e72fa done
#14 DONE 0.0s

View build details: docker-desktop://dashboard/build/default/default/aav2ix4nw5eky66fw045dkylr

$ jq . ~/.docker/buildx/refs/default/default/w38vcd5fo5cfvfyig77qjec0v
{
  "Target": "default",
  "LocalPath": "/home/crazy/hello",
  "DockerfilePath": "/home/crazy/hello/-"
}

With this change we set LocalPath and DockerfilePath accordingly if a remote context is used or stdin.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@crazy-max crazy-max added this to the v0.16.0 milestone Jun 28, 2024
@github-actions github-actions Bot added area/build area/tests labels Jun 28, 2024
@crazy-max
test: build remote
d4b112a
Signed-off-by: CrazyMax <[email protected]>
@crazy-max
crazy-max force-pushed the fix-localstate-remote branch 6 times, most recently from 06bb273 to 42f1086 Compare June 28, 2024 09:50
@crazy-max

crazy-max commented Jun 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

When checking Inputs.ContextPath, I found that it is not the same when building through controller:

$ BUILDX_EXPERIMENTAL=1 docker buildx build -f hello.Dockerfile .
...
#10 exporting to image
#10 exporting layers done
#10 writing image sha256:9deae3ebca280147d5096bd8858e2a008014cd6cc2e7b33e6307f06cbf11d992 done
#10 DONE 0.0s

View build details: docker-desktop://dashboard/build/default/default/nb6ivxlwkacfvnxach0m1vg9g

$ jq . ~/.docker/buildx/refs/default/default/nb6ivxlwkacfvnxach0m1vg9g
{
  "ContextPath": "/home/crazy/hello",
  "Target": "default",
  "LocalPath": "/home/crazy/hello",
  "DockerfilePath": "/home/crazy/hello/hello.Dockerfile"
}

Without controller:

$ docker buildx build -f hello.Dockerfile .
...
#11 exporting to image
#11 exporting layers done
#11 writing image sha256:9deae3ebca280147d5096bd8858e2a008014cd6cc2e7b33e6307f06cbf11d992 done
#11 DONE 0.0s

View build details: docker-desktop://dashboard/build/default/default/szmtd9nf4urns5872py50l9pm

$ jq . ~/.docker/buildx/refs/default/default/szmtd9nf4urns5872py50l9pm
{
  "ContextPath": ".",
  "Target": "default",
  "LocalPath": "/home/crazy/hello",
  "DockerfilePath": "/home/crazy/hello/hello.Dockerfile"
}

Seems related to

buildx/controller/pb/path.go

Line 17 in 04000db

options.ContextPath, err = filepath.Abs(options.ContextPath)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max
crazy-max force-pushed the fix-localstate-remote branch 3 times, most recently from fae21af to a106f33 Compare June 28, 2024 12:51
@crazy-max crazy-max changed the title build: fix localstate for remote context build: fix localstate for remote context and stdin Jun 28, 2024
@crazy-max
build: fix localstate for remote context and stdin
cfb7fc4
Signed-off-by: CrazyMax <[email protected]>
@crazy-max
crazy-max force-pushed the fix-localstate-remote branch from a106f33 to cfb7fc4 Compare June 28, 2024 12:56
@crazy-max

crazy-max commented Jun 28, 2024

Copy link
Copy Markdown
Member Author

Added integration tests

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max
crazy-max marked this pull request as ready for review June 28, 2024 13:08
@crazy-max
crazy-max requested a review from tonistiigi June 28, 2024 13:08
tonistiigi
tonistiigi approved these changes Jun 28, 2024
View reviewed changes
@tonistiigi
tonistiigi merged commit 63eb73d into docker:master Jun 28, 2024
@crazy-max
crazy-max deleted the fix-localstate-remote branch June 29, 2024 10:04
This was referenced Jul 5, 2024
buildx: convert vertex warnings to github annotations based on localstate docker/actions-toolkit#401
Merged
buildx: fix broken local state docker/actions-toolkit#403
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tonistiigi tonistiigi tonistiigi approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area/build area/tests

Projects

None yet

Milestone

v0.16.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@crazy-max @tonistiigi
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.