-
Notifications
You must be signed in to change notification settings - Fork 305
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 building on windows #352
Conversation
Thanks for the PR. However I'm quite confused. The |
All of this only works on Linux, but much of it builds on Windows. Also, even on Linux, if a service is not started by For the For another example, the This leads to a useful pattern that gets used on Linux, but is useful on Windows/macOS/etc also: call into I'm not saying henceforth you should support building on Windows, especially when the cost is high, but here the cost seems low? It's up to you really. Feel free to drop this if you don't think you want to support this. |
@ncruces happy to land something like this if it is useful to you :) |
One possible goal might be just to ensure that it builds for Windows/macOS, which given Go's cross compilation support might not be hard to add to CI even if that runs on Linux. Any Linux tests that ensure that in the absence of But for CI to make sense, I'd have to look at why some other modules don't build. And really, although this is useful to me, I also understand the view that, and don't want to burden you with, maintaining something that might break in the future, and is basically just a nop. |
I went back and looked. This works as is, macOS:
This fails, Windows:
So there'd be |
Oh my! Sorry for messing this up!
|
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There was three types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests coudn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags Path Sensitivity In windows paths are case-sensitive but on unix they are not
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There was three types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests coudn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags Path Sensitivity There was some case-sensitivity issues related to macos and CI N
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There was two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests coudn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491^https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There was two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests coudn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491^https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There was two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests coudn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491^https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There were two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491^https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There were two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491^https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There were two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491^https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://bugs.launchpad.net/juju-core/+bug/1403084 There were two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 There were two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 There were two types of issues for running tests on windows. `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include some os specific binary files. Solution is to exclude problematic modules on window build via comment tags CI GitHub actions is instructed to install chocolatey, but according to CI history tests themselves were never run on windows. Moreover, I am not sure how `testing/mgo module can get mongo binary on windows - https://github.com/juju/testing/blob/2be42bba85f32755618cf63d68e7b60dc5e6e911/mgo.go#L487-L491 I have removed chocolatey mongo installation instructions and provided a way for excluding the mongo during the test run. Until we can clarify `testing/mgo` issue and if we want to fix it
Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include some os specific binary files. Solution is to exclude problematic modules on window build via comment tags
Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include some os specific binary files. Solution is to exclude problematic modules on window build via comment tags
Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include some os specific binary files. Solution is to exclude problematic modules on window build via comment tags
Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include some os specific binary files. Solution is to exclude problematic modules on window build via comment tags
Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include some os specific binary files. Solution is to exclude problematic modules on window build via comment tags
Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include some os specific binary files. Solution is to exclude problematic modules on window build via comment tags
#12566 Fixes https://discourse.charmhub.io/t/building-juju-2-5-0-on-windows/549 ## `coreos/go-systemd' Not all of the parts of systemd is buildable on windows, there is currently a PR open for it - coreos/go-systemd#352. But even with these changes our tests couldn't build the test suits. Since we are using `github.com/coreos/go-systemd/v22/util` which tries to include some os specific binary files. Solution is to exclude problematic modules on window build via comment tags ## Checklist - [ ] Requires a [pylibjuju](https://github.com/juju/python-libjuju) change - [ ] Added [integration tests](https://github.com/juju/juju/tree/develop/tests) for the PR - [ ] Added or updated [doc.go](https://discourse.jujucharms.com/t/readme-in-packages/451) related to packages changed - [x] Comments answer the question of why design decisions were made
@ncruces can you please rebase on current master and squash your changes into a single commit? |
These changes allow go-systemd to build on Windows. Ideally, on platforms (like Windows) where systemd is not available, go-systemd should behave similarly to how it does on Linux, when a service is not started by systemd. Tipically this is default, no-op, behavior.
Hi @lucab! |
activation
doesn't build on Windows becausesyscall.CloseOnExec
takes asyscall.Handle
rather than anint
there.go-systemd/activation/files.go
Lines 55 to 59 in 87511f3
This fixes this with a build constraint returning
nil
on Windows, which makes it a NOP and I guess follows the philosophy of most of the project.