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

version, metrics: allow to build on non-unix platforms #16679

Merged
merged 2 commits into from Jul 15, 2021

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Jun 29, 2021

These packages are transitive dependencies in cilium-cli, but currently they
fails to build on non-unix platforms (e.g. windows) due to their use of
golang.org/x/sys/unix.

However, we want still to be able to build it for some these platforms,
see e.g. cilium/cilium-cli#231. Fix the build
by moving all unix-specific functionality (i.e. the Uname call) to
separate files, protected by build tags.

Also marking for backports to 1.10 since we vendor a stable cilium/cilium release into cilium-cli (currently v1.9.8, but switching to v1.10 with cilium/cilium-cli#358 once all necessary fixes have been backported).

@tklauser tklauser added release-note/misc This PR makes changes that have no direct user impact. needs-backport/1.10 labels Jun 29, 2021
@tklauser tklauser requested a review from a team as a code owner June 29, 2021 07:46
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.10.2 Jun 29, 2021
@tklauser tklauser changed the title version: split GetKernelVersion into separate file version, metrics: allow to build on non-unix platforms Jun 29, 2021
@tklauser tklauser requested a review from a team as a code owner June 29, 2021 07:54
@tklauser tklauser closed this Jun 29, 2021
@tklauser tklauser reopened this Jun 29, 2021
@tklauser
Copy link
Member Author

test-me-please

@tklauser
Copy link
Member Author

tklauser commented Jul 1, 2021

Rebased to pick up updated kind version to fix conformance test GH action failures.

@tklauser
Copy link
Member Author

tklauser commented Jul 1, 2021

test-me-please

@aanm aanm added this to Needs backport from master in 1.10.3 Jul 2, 2021
@aanm aanm removed this from Needs backport from master in 1.10.2 Jul 2, 2021
@tklauser
Copy link
Member Author

tklauser commented Jul 2, 2021

Rebased to pick up more conformance test fixes from master.

@tklauser
Copy link
Member Author

tklauser commented Jul 2, 2021

test-me-please

@tklauser
Copy link
Member Author

tklauser commented Jul 2, 2021

Copy link
Contributor

@errordeveloper errordeveloper left a comment

Choose a reason for hiding this comment

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

Thanks for doing this, Tobias!

I found that it's hard to prevent these sort of changes from breaking (had to fix some macOS builds a few times). Did you think of adding some kind of check that runs builds for different OSes, even if it's just a subset of packages for now?

@tklauser
Copy link
Member Author

tklauser commented Jul 8, 2021

Did you think of adding some kind of check that runs builds for different OSes, even if it's just a subset of packages for now?

Yeah, that's a good point. Though it will probably a bit of a challenge to determine the correct subset of packages we want to build on other platforms and I imagine it to change over time as well.

For now I'd go with anything imported by cilium/cilium-cli as well as any package in cilium/cilium which have darwin or windows build tags/file names. @errordeveloper any other packages that come to mind or that you remember having issues with on macOS in the past?

@errordeveloper
Copy link
Contributor

For now I'd go with anything imported by cilium/cilium-cli as well as any package in cilium/cilium which have darwin or windows build tags/file names.

Sounds good!

@errordeveloper any other packages that come to mind or that you remember having issues with on macOS in the past?

Personally, I think everything should be buildable, and it's ought to be possible to run pure unit tests, but that's not something we will be can realistically achieve very soon... How about the operator, I was able to work on it natively on macOS in the past, and in theory it should remain free of Linux-isms, right?

@tklauser
Copy link
Member Author

tklauser commented Jul 9, 2021

For now I'd go with anything imported by cilium/cilium-cli as well as any package in cilium/cilium which have darwin or windows build tags/file names.

Sounds good!

@errordeveloper any other packages that come to mind or that you remember having issues with on macOS in the past?

Personally, I think everything should be buildable, and it's ought to be possible to run pure unit tests, but that's not something we will be can realistically achieve very soon... How about the operator, I was able to work on it natively on macOS in the past, and in theory it should remain free of Linux-isms, right?

Created #16843 to track which packages we want to be able to build on non-Linux platforms.

@tklauser
Copy link
Member Author

Rebased to pick up CI 3.0 fixes.

@tklauser
Copy link
Member Author

test-me-please

@tklauser
Copy link
Member Author

tklauser commented Jul 13, 2021

test-gke

timed out waiting for CI images: https://jenkins.cilium.io/job/Cilium-PR-K8s-GKE/6006

This package is a transitive dependency in cilium-cli, but currently it
fails to build on non-unix platforms (e.g. windows) due to its use of
golang.org/x/sys/unix.

However, we want still to be able to build it for some these platforms,
see e.g. cilium/cilium-cli#231. Fix the build
by moving all unix-specific functionality (i.e. the Uname call) to a
separate file, protected by build tags.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
This package is a transitive dependency in cilium-cli, but currently it
fails to build on non-unix platforms (e.g. windows) due to its use of
golang.org/x/sys/unix.

However, we want still to be able to build it for some these platforms,
see e.g. cilium/cilium-cli#231. Fix the build
by moving all unix-specific functionality (i.e. the use of unix.Errno)
to a separate file, protected by build tags.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser
Copy link
Member Author

test-me-please

@tklauser tklauser added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jul 14, 2021
@nebril nebril merged commit 1da68d8 into cilium:master Jul 15, 2021
@tklauser tklauser deleted the version-windows-build branch July 15, 2021 12:07
@aanm aanm added this to Needs backport from master in 1.10.4 Jul 15, 2021
@aanm aanm removed this from Needs backport from master in 1.10.3 Jul 15, 2021
@joestringer joestringer moved this from Needs backport from master to Backport done to v1.10 in 1.10.4 Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.10.4
Backport done to v1.10
Development

Successfully merging this pull request may close these issues.

None yet

6 participants