-
Notifications
You must be signed in to change notification settings - Fork 263
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
Portable plugin executable check for Windows platform #367
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: navidshaikh 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 |
The following is the coverage report on pkg/.
|
kn builds with this change for Windows
|
I'm not sure we should remove the check since having a non-executable text file in your PATH is valid, but shouldn't show up as a plug-in when you If the real issue is that we can't compile certain files in Windows, can we just use golang's "build tags" and have the Windows version of that func be a no-op ? |
build tags are added per file basis AFAIK, we have executable check done as method, let mecheck if I can do better to fix this |
I tried and separated the non Windows platform check in separate file and add
may be we'll need to delegate the executable check to underlying platform |
can't you put the funcs that have linux vs windows versions into their own files and then only compile with the OS specific version? |
Wondering how come the nightly build has it built https://github.com/knative/client/blob/master/docs/README.md#installing-kn |
You are right! Didn't do better yet to fix this. :-/ |
builds Windows and non-Windows platform plugin verifier separately
@@ -12,6 +12,8 @@ | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
|
|||
// +build !windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builds for non-Windows platform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, when we mention GOOS=windows
while building cross platform binary it skips this file and picks up Windows specific version defining the needed methods / functions to verify plugin on Windows platform.
@@ -0,0 +1,190 @@ | |||
// Copyright © 2019 The Knative Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all the functions which are in plugin_verifier.go which are specific to non-Windows platform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a lot of that code could be in a common file and limit the plugin_verifier_windows.go
with only the Windows code. Is there a reason you could not do this?
Builds for all platform now
Used the code from
|
/test pull-knative-client-build-tests |
As we'll need either to mention, which file compiles for which platform.
Summary:
This should unblock the cross-platform builds. |
@maximilien @sixolet @duglin : I've verified this PR by building it for cross platform as mentioned in above comments, I think this is ready for review. //Cc: @adrcunha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok_to_test
@@ -0,0 +1,190 @@ | |||
// Copyright © 2019 The Knative Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a lot of that code could be in a common file and limit the plugin_verifier_windows.go
with only the Windows code. Is there a reason you could not do this?
@maximilien : It's the other way around actually, there are specific syscalls which are absent for And we can't reference the specific-platform-functions from a common function, We'll need to completely separate references and imports at compile time for Windows and non-Windows platforms, to mask the unavailable syscalls imports.
|
/lgtm |
OK cool. Thanks. I have no way to test nor use Windows, so glad you are on it. Thx |
Fixes #365
Proposed Changes
The code used for checking whether plugin is executable or not in plugin verifier
does not build for Windows. Builds Windows and non-Windows platform plugin verifier separately