Skip to content

fix: More silent cloud-init runs #614

fix: More silent cloud-init runs

fix: More silent cloud-init runs #614

Workflow file for this run

name: End-to-End Tests
on:
workflow_dispatch:
pull_request:
paths-ignore:
- docs/**
- "*.md"
concurrency: azure-vm
env:
az_name: wsl-ci
az_resource_group: wsl
jobs:
vm-setup:
runs-on: ubuntu-latest
steps:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_VM_CREDS }}
- name: Start the Runner
shell: bash
run: |
az vm start --name ${{ env.az_name }} --resource-group ${{ env.az_resource_group }}
end-to-end-tests:
runs-on: self-hosted
needs: vm-setup
env:
rootFsCache: "${env:USERPROFILE}\\Downloads\\rootfs"
# TODO: Move this to "Ubuntu" once we have backported everything and Ubuntu is transitionned to 24.04
distroName: Ubuntu-24.04
appID: Ubuntu24.04LTS
launcher: ubuntu2404.exe
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up MSBuild (PATH)
uses: microsoft/[email protected]
- name: Install certificate
shell: powershell
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.CERTIFICATE }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
$pwd = ConvertTo-SecureString '${{ secrets.CERTIFICATE_PASSWORD }}' -AsPlainText -Force
Import-PfxCertificate -Password $pwd -CertStoreLocation Cert:LocalMachine\Trust -FilePath certificate\certificate.pfx
Import-PfxCertificate -Password $pwd -CertStoreLocation Cert:CurrentUser\My -FilePath certificate\certificate.pfx
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: ./e2e/go.work
- name: Install or update WSL
uses: ./.github/actions/wsl-install
- name: Download rootfs
uses: ./.github/actions/download-rootfs
with:
distros: ${{ env.distroName }}
path: ${{ env.rootFsCache }}
- name: Build and install the appxbundle for testing
shell: powershell
run: |
Write-Output "::group::Clearing leftovers from previous runs"
$package=$(Get-AppxPackage | Where-Object PackageFullName -like *${{ env.appID }}*)
If ( $package -ne $null -And $package -ne '' ) {
Remove-AppxPackage $package
}
Write-Output "::endgroup::"
Write-Output "::group::Building and installing appbundle"
.\e2e\pre-e2e-testing.ps1 -AppID ${{ env.appID }} -RootfsX64 "${{ env.rootFsCache }}/${{ env.distroName }}.tar.gz"
Write-Output "::endgroup::"
- name: Run tests
shell: powershell
run: |
Write-Output "::group::Environment setup"
$env:LAUNCHER_REPO_ROOT=$PWD
$env:WSL_UTF8 = 1
# Shutting down WSL. This is sometimes necessary as it prevents "Access is denied" later.
wsl.exe --shutdown
wsl.exe --version
wsl.exe --unregister '${{ env.distroName }}' 2>&1 | Out-Null
cd e2e
Write-Output "::endgroup::"
Write-Output "::group::Tests"
go test .\launchertester\ -timeout 30m --distro-name '${{ env.distroName }}' --launcher-name '${{ env.launcher }}'
$exitStatus=$?
Write-Output "::endgroup::"
if ( ! $exitStatus ) { Exit(1) }
- name: Remove the installed package
if: always()
shell: powershell
run: |
Remove-AppxPackage "$(Get-AppxPackage | Where-Object PackageFullName -like *${{ env.appID }}*)"
stop-vm:
runs-on: ubuntu-latest
needs: [vm-setup, end-to-end-tests]
if: always()
steps:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_VM_CREDS }}
- name: Deallocate the Runner
shell: bash
run: |
az vm deallocate --name ${{ env.az_name }} --resource-group ${{ env.az_resource_group }}