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

Adds support for windows instances #104

Open
wants to merge 49 commits into
base: main
Choose a base branch
from

Conversation

crunchy234
Copy link

This change allows windows instances to be launched and used in the same way as Linux instances.

@rsmall-apira
Copy link

@machulav @crunchy234 I love this PR! While I can't speak to the goodness of the code, i really would love this functionality. I've really loved this Github action with my linux github runners, and I would love to use it with my Windows runners.

@crunchy234
Copy link
Author

Thanks @rsmall-apira.

We are already using it as part of our CI workflow, and it is working well so far.
this is the marketplace link if you want to use it yourself.

@mhriemers
Copy link

Awesome work @crunchy234 ! Hope this gets merged, will be using your version in the mean time.

@mhriemers
Copy link

@crunchy234 You switched around the cases for Windows when config.input.runnerHomeDir is defined. See crunchy234#1

@crunchy234
Copy link
Author

@crunchy234 You switched around the cases for Windows when config.input.runnerHomeDir is defined. See crunchy234#1

@mhriemers Thank you very much for this fix! This has now been merged and released as windows-support-7

@Dmitry1987
Copy link

I think there are syntax errors where backticks were replaced by single quote, in linux user-data section, the vars substitution doesn't work so runner won't start. i'm trying the windows now, but it never connects, wonder why it might be.. the 30 seconds timeout seems short, is it all the time allowed for windows to get reachable, or it's just the interval it checks once in 30 seconds?

await waitUntilInstanceRunning({client, maxWaitTime: 30, minDelay: 3}, params);

Comment on lines +170 to +184
For a Windows server instance, it looks like the following:

Note: This must be done over RDP since `choco install git` doesn't seem to install correctly over a session manager
connection

```.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install git

# Remove existing user data run once file (this is so that the user-data being set on instance start actually runs).
rm C:\ProgramData\Amazon\EC2Launch\state\.run-once
```
Note: The `.run-once` file needs to be deleted with every start of the instance you are snapshotting.
If you stop and reboot the instance a few times please make sure you delete the `.run-once` file before creating the
AMI.
Copy link
Author

Choose a reason for hiding this comment

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

@Dmitry1987 This is what you need to do to get the Windows instance to start correctly and run the passed-in user commands.

@Dmitry1987
Copy link

Dmitry1987 commented May 24, 2024 via email

@crunchy234
Copy link
Author

I also needed functionality to spin up multiple ec2 instances with the same label.

This is so I can run a matrix strategy with multiple python-versions in parallel like in normal GH actions.

So this functionality has also been added to this fork now too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants