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

Support exec plugin on Windows #3027

Merged
merged 3 commits into from
Oct 7, 2020
Merged

Conversation

gochist
Copy link
Contributor

@gochist gochist commented Sep 22, 2020

As discussed on #2924, we are now aware that the exec plugin is not available on Windows. This is because we can't check if the plugin is executable via file mode on Windows.

So, I changed the conditions for loading exec plugin so that the plugin can be used in Windows.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 22, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @gochist!

It looks like this is your first PR to kubernetes-sigs/kustomize 🎉. 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-sigs/kustomize 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
Copy link
Contributor

Hi @gochist. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 Sep 22, 2020
@gochist
Copy link
Contributor Author

gochist commented Sep 22, 2020

/assign @phanimarupaka

@Shell32-Natsu
Copy link
Contributor

/assign @monopole

@Shell32-Natsu
Copy link
Contributor

/unassign @phanimarupaka

@Shell32-Natsu
Copy link
Contributor

/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 Sep 22, 2020
if f.Mode()&0111 == 0000 {
// In Windows, it is not possible to determine whether a
// file is executable through file mode.
if f.Mode()&0111 == 0000 && runtime.GOOS != "windows" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test for this behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Shell32-Natsu Thank you for the review. I'm not good at Go development, but I tried to add a test. I tried to skip the test in Windows environment, what do you think?

Copy link
Contributor

@monopole monopole Oct 2, 2020

Choose a reason for hiding this comment

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

@gochist To line 55, can you add this:

// TODO: provide for setting the executable FileMode bit on Windows
// The (fs *fileStat) Mode() (m FileMode) {} function in
// in https://golang.org/src/os/types_windows.go
// lacks the ability to set the FileMode executable bit in response
// to file data on Windows.

I did a quick search for an issue upstream in the golang repo but couldn't find one, maybe you can try?

https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+Windows++filemode

seems like we'd need Go functions to read
// using perhaps https://docs.microsoft.com/en-us/windows/win32/secauthz/access-control-entries?redirectedfrom=MSDN

and we're not going to attempt that in kustomize.

Copy link
Contributor

Choose a reason for hiding this comment

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

then i think we should pull it in, and unblock windows use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@monopole Thank you. I've addressed your review. And I will open an issue in the golang repo within a few days.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@monopole I've opened an issue, golang/go#41809 in the golang repo.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 26, 2020
@@ -89,3 +92,32 @@ metadata:
t.Fatalf("unexpected arg array: %#v", p.Args())
}
}

func TestExecPlugin_ErrIfNotExecutable(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@monopole Could you take a look. I think this test should work but not sure about the practice that skip it on Windows.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, this is ok in this case.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: gochist
To complete the pull request process, please assign monopole after the PR has been reviewed.
You can assign the PR to them by writing /assign @monopole in a comment when ready.

The full list of commands accepted by this bot can be found 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

Copy link
Contributor

@monopole monopole left a comment

Choose a reason for hiding this comment

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

/lgtm
/ok-to-test

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 7, 2020
@monopole monopole merged commit 1bfcc81 into kubernetes-sigs:master Oct 7, 2020
@gochist gochist deleted the windows-exec branch October 8, 2020 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants