Skip to content

Comments

fix: use pre-release version of WSL#424

Merged
ginglis13 merged 1 commit intorunfinch:mainfrom
ginglis13:wsl-pre-release
Sep 28, 2023
Merged

fix: use pre-release version of WSL#424
ginglis13 merged 1 commit intorunfinch:mainfrom
ginglis13:wsl-pre-release

Conversation

@ginglis13
Copy link
Contributor

Issue #, if available:

Description of changes:

GitHub Actions connect to runners via session 0 / ssh. In versions of WSL installed from the Windows store (wsl --install), wsl cannot be invoked via connections over session 0. The pre-release version of WSL has patches to accommodate this, so install that version instead of the version provided by the Windows store.

related: microsoft/WSL#9231

Testing done:

Manually instance setup with minimal user data script:

version: 1.0
tasks:
- task: executeScript
  inputs:
  - frequency: once
    type: powershell
    runAs: admin
    content: |-
      wsl --install --no-distribution

      # Script runs on login after reboot to start GitHub Actions service, put the instance InService in the ASG,
      # and update wsl version to pre-release verion such that ssh / session 0 connections can call wsl
      $startupscript = @'
      Start-Transcript -Path "C:\StartupScript.log" -Append
      
      Invoke-WebRequest -Uri https://github.com/microsoft/WSL/releases/download/2.0.1/wsl.2.0.1.0.x64.msi -OutFile C:\Users\Administrator\wsl.2.0.1.0.x64.msi
      Start-Process msiexec.exe -Wait -ArgumentList '/i C:\Users\Administrator\wsl.2.0.1.0.x64.msi /L*V C:\wsllogs.txt /quiet'

      '@

      $startupscript | Out-File C:\startup.ps1

      # Register a scheduled job to run the script to regist the instance as a runner on boot.
      $trigger = New-JobTrigger -AtStartup -RandomDelay 00:00:30
      Register-ScheduledJob -Trigger $trigger -FilePath C:\startup.ps1 -Name startup-job-inservice

      Restart-Computer

Access instance via SSM Connect after reboot, verified existence of C:\Program Files\WSL, C:\Program Files\WSL\wsl.exe --version -> 2.0.1.0

  • I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ginglis13 ginglis13 requested a review from a team September 28, 2023 05:33
GitHub Actions connect to runners via session 0 / ssh. In versions of
WSL installed from the Windows store (wsl --install), wsl cannot be
invoked via connections over session 0. The pre-release version of WSL
has patches to accommodate this, so install that version instead.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
@ginglis13 ginglis13 merged commit 5b8bf1a into runfinch:main Sep 28, 2023
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.

2 participants