Skip to content
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

fix: handle DOS-style path for Dockerfile in minikube build #15074

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

ComradeProgrammer
Copy link
Member

@ComradeProgrammer ComradeProgrammer commented Oct 5, 2022

fixes #15007

Here is an example to reproduce the problem. The folder is

.
├── .dockerignore
└── test
    └── Dockerfile

The content of .dockerignore

**/Dockerfile*

The content of dockerfile

FROM ubuntu:latest

CMD ["/bin/bash", "-c"]

Output:
When I execute .\minikube-windows-amd64.exe image build -t aaa:latest -f test\Dockerfile ., using DOS-style path

PS D:\workspace\minikube> .\minikube-windows-amd64.exe image build -t aaa:latest -f test\Dockerfile .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat var/lib/minikube/build/build.519194499/test\Dockerfile: no such file or directory

When I execute .\minikube-windows-amd64.exe image build -t aaa:latest -f test/Dockerfile ., using UNIX-style path

PS D:\workspace\minikube> .\minikube-windows-amd64.exe image build -t aaa:latest -f test/Dockerfile .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /var/lib/minikube/build/build.4139476469/test/Dockerfile: no such file or directory

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 5, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: ComradeProgrammer / name: Товарищ программист (76950eb, 0bb29fe)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Oct 5, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @ComradeProgrammer!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 5, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @ComradeProgrammer. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 5, 2022
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 5, 2022
cmd/minikube/cmd/image.go Outdated Show resolved Hide resolved
@ComradeProgrammer
Copy link
Member Author

Here is an example to reproduce the problem. The folder is

.
├── .dockerignore
└── test
    └── Dockerfile

The content of .dockerignore

**/Dockerfile*

The content of dockerfile

FROM ubuntu:latest

CMD ["/bin/bash", "-c"]

Output:
When I execute .\minikube-windows-amd64.exe image build -t aaa:latest -f test\Dockerfile ., using DOS-style path

PS D:\workspace\minikube> .\minikube-windows-amd64.exe image build -t aaa:latest -f test\Dockerfile .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat var/lib/minikube/build/build.519194499/test\Dockerfile: no such file or directory

When I execute .\minikube-windows-amd64.exe image build -t aaa:latest -f test\Dockerfile ., using UNIX-style path

PS D:\workspace\minikube> .\minikube-windows-amd64.exe image build -t aaa:latest -f test/Dockerfile .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /var/lib/minikube/build/build.4139476469/test/Dockerfile: no such file or directory

cmd/minikube/cmd/image.go Outdated Show resolved Hide resolved
@spowelljr
Copy link
Member

Tested this and confirms it works

Before:

> minikube image build -t thing:latest -f thing2\Dockerfile .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /var/lib/minikube/build/build.3965132197/thing2\Dockerfile: no such file or directory

After:

> minikube image build -t thing:latest -f thing2\Dockerfile .
Sending build context to Docker daemon   2.56kB
Step 1/2 : FROM ubuntu:latest
 ---> 216c552ea5ba
Step 2/2 : CMD ["/bin/bash", "-c"]
 ---> Running in 5b64e4107d63
Removing intermediate container 5b64e4107d63
 ---> a5b667236e51
Successfully built a5b667236e51
Successfully tagged thing:latest

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

@ComradeProgrammer Lets make sure this replace is only suggested by minikube and not automatically done, if minikube gonna replace it, it has to get user permission to clearly say "Yes" it is better to leave this operation to the user

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 11, 2022
@ComradeProgrammer
Copy link
Member Author

ComradeProgrammer commented Oct 11, 2022

@ComradeProgrammer Lets make sure this replace is only suggested by minikube and not automatically done, if minikube gonna replace it, it has to get user permission to clearly say "Yes" it is better to leave this operation to the user

This feature has been added, now the we need user's permission to replace the \

cmd/minikube/cmd/image.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/image.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/image.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 17, 2022
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 17, 2022
@ComradeProgrammer
Copy link
Member Author

@spowelljr Indeed you are right, so I changed the code. Instead of asking for user's input, I switched to command line arguments.
I added a param called "--no-dospath-conversion". By default the DOS-like path is automatically converted, but if user use this --no-dospath-conversion then there will be no conversion. Do you think it is better this time?

@medyagh
Copy link
Member

medyagh commented Mar 13, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 13, 2023
@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

cmd/minikube/cmd/image.go Outdated Show resolved Hide resolved
test/integration/functional_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 25, 2023
@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

test/integration/functional_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 7, 2023
test/integration/functional_test.go Outdated Show resolved Hide resolved
@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

@ComradeProgrammer
Copy link
Member Author

ComradeProgrammer commented Jun 8, 2023

@spowelljr It seems that the test under Docker_Windows has passed, is there anything else I should do?

cmd/minikube/cmd/image.go Outdated Show resolved Hide resolved
@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 15074) |
+----------------+----------+---------------------+
| minikube start | 49.5s    | 53.1s               |
| enable ingress | 27.4s    | 27.6s               |
+----------------+----------+---------------------+

Times for minikube start: 52.6s 49.1s 48.8s 48.5s 48.7s
Times for minikube (PR 15074) start: 55.0s 53.0s 53.4s 54.7s 49.6s

Times for minikube ingress: 27.7s 27.1s 27.1s 27.1s 28.2s
Times for minikube (PR 15074) ingress: 27.1s 27.2s 29.1s 28.1s 26.6s

docker driver with docker runtime

+-------------------+----------+---------------------+
|      COMMAND      | MINIKUBE | MINIKUBE (PR 15074) |
+-------------------+----------+---------------------+
| minikube start    | 22.7s    | 23.0s               |
| ⚠️  enable ingress | 20.8s    | 32.9s ⚠️             |
+-------------------+----------+---------------------+

Times for minikube start: 21.0s 23.8s 24.4s 23.5s 21.0s
Times for minikube (PR 15074) start: 24.6s 23.9s 21.1s 21.2s 24.3s

Times for minikube ingress: 20.8s 21.8s 19.8s 20.8s 20.8s
Times for minikube (PR 15074) ingress: 81.3s 20.8s 20.8s 20.8s 20.8s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 15074) |
+----------------+----------+---------------------+
| minikube start | 21.7s    | 22.2s               |
| enable ingress | 34.3s    | 31.5s               |
+----------------+----------+---------------------+

Times for minikube start: 22.6s 20.4s 19.6s 22.3s 23.6s
Times for minikube (PR 15074) start: 23.2s 20.5s 22.7s 22.4s 22.1s

Times for minikube ingress: 30.3s 31.3s 31.3s 31.3s 47.3s
Times for minikube (PR 15074) ingress: 31.3s 30.8s 31.3s 31.8s 32.3s

@minikube-pr-bot
Copy link

These are the flake rates of all failed tests.

Environment Failed Tests Flake Rate (%)
QEMU_macOS TestFunctional/parallel/ImageCommands/ImageListJson (gopogh) 6.38 (chart)
Docker_Linux_crio TestFunctional/parallel/ImageCommands/ImageLoadDaemon (gopogh) 10.26 (chart)

To see the flake rates of all tests by environment, click here.

Copy link
Member

@spowelljr spowelljr left a comment

Choose a reason for hiding this comment

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

PR looks good, thanks for all the changes

@spowelljr spowelljr merged commit 18ff76a into kubernetes:master Jun 12, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ComradeProgrammer, spowelljr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

minikube image build path handling issue in Windows
7 participants