Skip to content

Commit

Permalink
CI: BATS: Fix installing WSL distribution
Browse files Browse the repository at this point in the history
For some reason, using `wsl --install debian` started failing, but manually
downloading the package and installing from there is fine; switch to doing
that instead, since WSL is already manually updated.  The error is:

> Installing: Debian GNU/Linux
> There are no more endpoints available from the endpoint mapper.
> Error code: Wsl/InstallDistro/0x800706d9

Signed-off-by: Mark Yen <[email protected]>
  • Loading branch information
mook-as committed Jun 19, 2024
1 parent 000263c commit 191831c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 2 additions & 5 deletions .github/actions/setup-environment/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ runs:
do {
wsl --update
} while ( -not $? )
- name: "Windows: Finish setting up WSL"
if: runner.os == 'Windows'
shell: pwsh
run: wsl --set-default-version 2
# Setting the default version also lets WSL finish updating.
wsl --set-default-version 2
- name: "Linux: Enable KVM access"
if: runner.os == 'Linux'
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/bats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,18 @@ jobs:

- name: "Windows: Install WSL2 Distribution"
if: runner.os == 'Windows'
shell: pwsh
shell: powershell # pwsh doesn't have Add-AppxPackage
run: |
# Install Debian, but do not launch it
wsl --install Debian --no-launch
# `wsl --install` seems to have issues in CI since 2024-06-14; however,
# manually downloading the Debian installer and running it works.
Invoke-WebRequest https://github.com/microsoft/WSL/raw/master/distributions/DistributionInfo.json |
Select-Object -ExpandProperty Content |
ConvertFrom-JSON |
Select-Object -ExpandProperty Distributions |
Where-Object Name -EQ "Debian" |
Select-Object -ExpandProperty Amd64PackageUrl |
% { Invoke-WebRequest $_ -OutFile Debian.AppxBundle }
Add-AppxPackage Debian.AppxBundle
# Initialize Debian, without going through any first-time setup
debian.exe install --root
Expand Down

0 comments on commit 191831c

Please sign in to comment.