-
Notifications
You must be signed in to change notification settings - Fork 349
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
feat: Include dockerized protoc #404
Conversation
I ran into the same issue you reported in the other PR (that all |
@sgielen Yeah, I we could definitely However, dockerizing does replace the protoc dependency with docker. To be fair, it's more reliable and straightforward to depend on docker, rather than protoc, but it will exclude some developers who cannot install docker for some reason. My idea would be that sourcing the However, there would be no option to switch this behavior when using the run scripts. |
@boukeversteegh this looks great! Yeah, good point on the aliasing letting developers opt-in / out of needing to have docker installed. I guess I'm kind of biased, I've been using docker for awhile now so generally take it for granted. I wouldn't mind making that a simplifying function, if only for things like "updating the bin files". I pulled this down locally to poke around (I like it!) and per @sgielen 's musing, I pushed up a small commit to this PR (hope that's okay!) that adds ~3-4 And, yeah, personally I'd be fine with these docker-enabled commands being the primary/only-ish way we provide, at least via the So, dunno, at least as a 1st/baby step, I could see removing the current |
@stephenh thank you for your positive reaction :) command names I like the separate run commands you made. The big setup command takes quite some time to run, so I started to run things separately, but I ended up messing it up often, by not being careful what I should run, when, and in what order. So in the end its good to have a single combined command, or it should be clear how the separate commands should be used. What could help is command names that reflect the process a bit better. For example:
I think these names will make it more clear. Although I would personally also be happy with a But in general replacing the big 'setup' script with separate commands running in docker, and updating the readme sounds like a valuable improvement, i.e. a good step forward. making docker primary Well it would have benefits, I'm not against it. Getting the small extra commit When running the npm commands from Webstorm (my IDE), no $PWD is passed which gave an error, so I updated the compose file to use |
Sure, I like those names. And yeah, we could probably have both a single
Ah shoot, that sucks. Out of curiosity, would the docker-based |
Cool! Yeah let's keep a single command as well. The new command that work in docker do away with the windows compatibility issue immediately. Docker on windows runs really well once it's installed and you can be sure the commands will work without issue. However, there was an issue with HyperV, an operating system feature for hardware virtualization and virtual box used to not work when hyperv is on. A quick search shows that nowadays vbox is compatible with HV but it is slower and may require reconfiguration of existing VMs after enabling. Then I also remember some colleagues at my past job who could not get docker to work on their work laptops. This is more likely related to security restrictions put in place by the company's sys admins. Another issue is that HyperV is not available on the Home editions of windows, although there's now a way to install docker through the integrated Linux called Windows Subsystem for Linux, which then doesn't require windows professional. So in short, in some cases, installing docker is not straightforward and I think some users will be happy if they don't need docker to contribute to ts proto. I can update the scripts to be compatible to be run natively on windows, sometime tomorrow probably. Cheers! |
… integration test
Hello! I've made some updates. Please have a look if you're okay with these changes. Changes:
I took the liberty to rename Feedback welcome. If all is good, I think it can be merged. There are no loose ends as far as I'm aware. PS: With this PR we can consistently generate the |
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.
@boukeversteegh great, this lgtm! And yeah, I think just include the latest/3.19 updated bins in this PR as well. That way everything should be clean on main
after this lands.
Thank you for your review and approval! I've updated the bins, one test case, and added some notes in the readme about the dockerized protoc. Feel free to squash/merge if tests pass. |
(or should I merge, so that my name shows up in the commit?) |
Not sure why, but there's a difference in the As far as I understand this script does not rely on I'm trying again running from the host, hopefully that resolves the build error. This kind of means that we should switch the build scripts to use docker as well, otherwise we are pointing developers to use the dockerized scripts, whose output will - in the end - not be accepted by the pipeline. Any help would be appreciated. |
# Conflicts: # integration/grpc-js/simple.bin
@boukeversteegh I made a few small tweaks, and then ran |
🎉 This PR is included in version 1.91.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@boukeversteegh okay, so there was actually some non-determinism here; it turns out that imported files like But only non-triple-nested I ended up fixing this in #418 but only after several other "smashing the hammer on random things" changes. :-) |
Wow, I'm amazed you were able to figure this out. I will be careful in future PRs to change too many things at once. |
@stephenh I managed to dockerize protoc pretty neatly using a generic
protoc.Dockerfile
, and adocker-compose.yml
file that configures it for use with ts-proto.This will help developers working on ts-proto, and can be used during integration.
Usage
# Example ts-protoc --ts_proto_out=out -I integration/value integration/value/value.proto
protoc ARGS
is equivalent to:protoc
anywhere on your system.Notes
/ts-proto
protoc
is launched is mounted into/host
in the container/host
protoc
in any directory, and refer to host files using relative paths../foo.proto
), as the parent folder will not be mounted on the container.protoc
from the ts-proto root folder, the working directory will contain the protoc-gen-ts_proto file, so then you won't need to specify the--plugin
parameter. For some reason, I cannot manage to make the internalprotoc
recognize the ts-proto plugin binary from the PATH variable. Even though the binary is globally accessible from within the container.protoc-sh
which will launch the container into the shell.Todo
As I'm not familiar with the actual integration and test process, I hope someone would be willing to do that part. In theory it should be as simple as importing the
aliases.sh
file, which overwritesprotoc
with the dockerized version.