From 191831cdaf623682c9d295b49fd2850e1e354ef1 Mon Sep 17 00:00:00 2001 From: Mark Yen Date: Tue, 18 Jun 2024 10:17:53 -0700 Subject: [PATCH] CI: BATS: Fix installing WSL distribution 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 --- .github/actions/setup-environment/action.yaml | 7 ++----- .github/workflows/bats.yaml | 14 +++++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup-environment/action.yaml b/.github/actions/setup-environment/action.yaml index dae592a9941..1cdf9b1a691 100644 --- a/.github/actions/setup-environment/action.yaml +++ b/.github/actions/setup-environment/action.yaml @@ -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' diff --git a/.github/workflows/bats.yaml b/.github/workflows/bats.yaml index f00906acb9f..b2646b4d1c1 100644 --- a/.github/workflows/bats.yaml +++ b/.github/workflows/bats.yaml @@ -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