cdk-github-runners icon indicating copy to clipboard operation
cdk-github-runners copied to clipboard

Windows runner

Open kichik opened this issue 2 years ago • 4 comments

kichik avatar Jun 21 '22 17:06 kichik

If there's any pointers here, I'd be interested in possible trying to PoC or contribute this!

RichiCoder1 avatar Jun 27 '22 23:06 RichiCoder1

Thanks @RichiCoder1 ! There are two steps required to get there. First we need a Dockerfile that defines an image including the runner, awscli, gh, and latest git. It should be named src/providers/docker-images/codebuild/linux-x64/Dockerfile. If we can get it working on arm64 and/or Fargate too, that'd be even better. That part I could really use the help as Docker refuses to build Windows images on my machine.

The second part is building this image. We can't use CodeBuild to build Windows Docker images because CodeBuild doesn't support that. I am working on adding support for AWS Image Builder to build images for Windows. It will be needed for EC2 support too as those need AMI and CodeBuild can't build them too easily. If you're interested in helping on this part too, I can push what I have to a branch. It's still very raw.

kichik avatar Jun 28 '22 01:06 kichik

@kichik Certainly! I know docker and windows is its own fun circus to get working, something we're currently working on which prompted this request :)

RichiCoder1 avatar Jun 28 '22 01:06 RichiCoder1

This is the Dockerfile I have for now. I was able to get it running manually. We would still need to use AWS Image Builder to build it and update CodeBuild to use it with PowerShell.

FROM mcr.microsoft.com/windows/servercore:ltsc2019

WORKDIR /tmp

# awscli
RUN msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi

# github cli
RUN curl -w "%{redirect_url}" -fsS https://github.com/cli/cli/releases/latest | powershell $X = $Input -Split '/'; $GH_VERSION = $X[-1].substring(1); \
    $ProgressPreference = 'SilentlyContinue'; \
    Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_windows_amd64.msi" -OutFile gh.msi && \
    msiexec.exe /i gh.msi && del gh.msi

# git
RUN curl -fsSL https://github.com/git-for-windows/git/releases/download/v2.37.1.windows.1/Git-2.37.1-64-bit.exe -o git-setup.exe && git-setup.exe /VERYSILENT && del git-setup.exe

# runner
ARG RUNNER_VERSION=latest
WORKDIR /actions
RUN curl -w "%{redirect_url}" -fsS https://github.com/actions/runner/releases/latest | powershell $X = $Input -Split '/'; $RUNNER_VERSION = $Env:RUNNER_VERSION; if ($RUNNER_VERSION -eq 'latest') { $RUNNER_VERSION = $X[-1].substring(1) }; \
    $ProgressPreference = 'SilentlyContinue'; \
    Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-win-x64-${RUNNER_VERSION}.zip" -OutFile actions.zip; \
    Expand-Archive actions.zip -DestinationPath . && del actions.zip

kichik avatar Jul 23 '22 23:07 kichik

@RichiCoder1 would you be able to take a look at PR #94 and maybe even try it?

kichik avatar Sep 06 '22 23:09 kichik

@kichik Apologies, I just saw this 😅

RichiCoder1 avatar Sep 08 '22 20:09 RichiCoder1

@RichiCoder1 no worries. I plan to release probably this weekend, but any feedback would be appreciated even after that.

kichik avatar Sep 08 '22 20:09 kichik