-
Notifications
You must be signed in to change notification settings - Fork 31
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
Windows fixes #28
Windows fixes #28
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
I tested on Win 10 Pro 20H2 and Ubuntu 20.04 under WSL2. I see the CI is using cloudbuild, which I'm not familiar with. A bit of Googling reveals there is a community maintained Windows builder. The instructions imply I cannot simply add this into the CI in a PR, but rather there is some setup to do in the GCP project. Would you be amendable to adding Windows checks to the CI in this way, please? |
Hey Andrew, first of all thanks a lot for the PR. Let me see what I can do for the CI part, I have a free day tomorrow and hope to get it done then. |
Andrew, I checked the Windows builder and it seems a bit overkill in terms of maintenance, added costs, and security implications (Cloud Build would essentialy become able to spawn VMs in the project at will). If you're ok with it, I'm fine with having a couple extra tests for Windows that will only be run manually. I don't use Windows anyway. :) As for the PR, it looks great. My only nit is about the added complexity. Would you be against
Unless I'm mistaken, the change should be pretty straightforward. |
Another option on the CI could be to use GitHub Actions, but it'd require you to insert an SA key into GitHub Secrets to execute the tests, but I can understand why having another CI mechanism could be unattractive. I hear you on the complexity. It stems from the current behaviour. cleanup unlinks all symlinks it finds specified in extra_files whether or not those links were created in setup. When we're copying on Windows, I do not think it is appropriate to delete files that were not created by setup. If you agree I can change the existing behaviour so that only symlinks created by setup are removed in cleanup I could simplify the implementation hugely. The filenames parameter of cleanup would become the subset of extra_files that linked by setup, setup would have a simple "if Windows copy else symlink", and cleanup would always be os.unlink. Are you happy for me to proceed on that basis? |
I have to check if we can use Github Actions, I seem to remember some caveat there. Let me get back to you on this.
Absolutely! And thanks again for this. |
* Manage temporary files in a Windows-friendly way
c037dac
to
f8b882b
Compare
Rebased & force pushed new changes as discussed. Much cleaner now. |
Thanks a lot! I'm merging this now, and will then cut a new release and push it on pypi. As for Windows tests, I'm not enthusiastic about having to spin up a new Windows VM every time tests run, and of the implications of granting compute engine admin permissions to the CI agent. o you think there's a way of concocting a wine container, and running Windows Python in it? That would be super easy to integrate. |
master does not run on Windows (in general) for two reasons:
(1) is resolved by modifying TerraformTest to copy 'extra_files' if we detect we're running on Windows, track successfully copied files, and deleting them in the cleanup routine. This is made overly complex because the existing behaviour cleans up symlinked files that already existed but preserves not-symlinked-files. Since the Windows implementation is now copying files, we have to track successfully copied files separately. If the existing behaviour is in-fact a bug, and only those files symlinked by the setup routine should later be cleaned up, I can simplify the implementation further.
(2) is resolved by in one case by closing the temp files handle immediately, since we only really want a file name that Terraform can write output files to. In the other case, where we actually want the file to exist, so we tell NamedTemporaryDirectory not to track the file for deletion and handle that ourselves.