Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Check init tasks #478

Merged
merged 27 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b1b6b3c
feat: Make the launcher aware of cloud-init
CarlosNihelton Jun 4, 2024
23f99fd
Fix WLS typo
CarlosNihelton Jun 27, 2024
4baff0e
Re-enable some end-to-end test cases
CarlosNihelton Jun 27, 2024
8b7663b
Remove e2e test relying on the OOBE
CarlosNihelton Jun 27, 2024
679dd52
Implements TestFixturePath
CarlosNihelton Jun 27, 2024
fe75ee5
Fix testCorrectUpgradePolicy
CarlosNihelton Jun 27, 2024
8d64885
Implements testFileExists
CarlosNihelton Jun 27, 2024
a6f7ac9
We can now specify if we want the user to be root or not.
CarlosNihelton Jun 27, 2024
8a147a5
Removes some t.Parallel()
CarlosNihelton Jun 27, 2024
3b4636a
Implements tests that rely on cloud-init
CarlosNihelton Jun 27, 2024
2ed7d6e
Runs all existing tests and increase timeout
CarlosNihelton Jun 27, 2024
2a46c82
End-to-end tests with the latest LTS
CarlosNihelton Jun 27, 2024
fe16135
fix test data
CarlosNihelton Jul 9, 2024
5ace6b7
Add a TODO to use the Ubuntu app in end-to-end tests
CarlosNihelton Jul 4, 2024
cbcc93d
Comments to clarify the search for the default user
CarlosNihelton Jul 5, 2024
7585be3
Replace custom ini "parser" by GetPrivateProfileString
CarlosNihelton Jul 5, 2024
a491c19
Do not attempt to fix /etc/wsl.conf
CarlosNihelton Jul 5, 2024
49994b7
Ask for forgiveness, not permission
CarlosNihelton Jul 5, 2024
722054a
The most beautiful C++ passwd parser ever written ;)
CarlosNihelton Jul 8, 2024
f17b114
More consistent error reporting
CarlosNihelton Jul 8, 2024
8290991
Adds a test case with the default user already set in the registry
CarlosNihelton Jul 9, 2024
84fc27f
[NEW!!!] Adds test cases for higher UIDs and broken passwd
CarlosNihelton Jul 10, 2024
8ebea3d
Comment about parsing broken passwd lines
CarlosNihelton Jul 10, 2024
4bf78f0
Allow bash.exe handle symlinks on Windows
CarlosNihelton Jul 10, 2024
64fc551
Sprinkles some "Setup:" in log and error lines
CarlosNihelton Jul 10, 2024
4eb3c22
Fix syntax error on e2e workflow file
CarlosNihelton Jul 10, 2024
acfdc4a
Prevents 'cannot index into null array' exception in powershell
CarlosNihelton Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/actions/download-rootfs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,31 @@ runs:
foreach ($release in $releaseList) {
$data = $release -split "\s+"

if ($data.Count -lt 2) {
Write-Output "Error: not enough fields in release info: $release"
$allSuccess = $false
continue
}

# $name is the one in inputs.distros
$name = $data[0]
$file = ".\${name}.tar.gz"
$url = $data[1]

if ($name.Length -eq 0 -or $url.Length -eq 0) {
Write-Output "Error: empty fields in release info: $release"
$allSuccess = $false
continue
}

$file = ".\${name}.tar.gz"

& ${{ github.action_path }}\download-rootfs.ps1 -Path "${file}" -URL "$url"
if ( ! $? ) {
$allSuccess = $false
Write-Output "Error: Could not download ${name}"
}

$allSuccess = $true
Write-Output "::endgroup::"
}

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
path: repo
- name: Copy under workDir (which has more space to build the package)
shell: bash
# Bash.exe wouldn't know how to handle the symlinks inside docs/ without the export below.
run: |
export MSYS=winsymlinks:nativestrict
mkdir -p $(dirname ${{ env.workDir }})
mv ${GITHUB_WORKSPACE}/repo ${{ env.workDir }}
cd ${{ env.workDir }}
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
paths-ignore:
- docs/**
- *.md
- "*.md"
concurrency: azure-vm

env:
Expand All @@ -28,9 +28,10 @@ jobs:
needs: vm-setup
env:
rootFsCache: "${env:USERPROFILE}\\Downloads\\rootfs"
distroName: Ubuntu-Preview
appID: UbuntuPreview
launcher: ubuntupreview.exe
# TODO: Move this to "Ubuntu" once we have backported everything and Ubuntu is transitionned to 24.04
distroName: Ubuntu-24.04
didrocks marked this conversation as resolved.
Show resolved Hide resolved
appID: Ubuntu24.04LTS
launcher: ubuntu2404.exe
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -88,7 +89,7 @@ jobs:
Write-Output "::endgroup::"

Write-Output "::group::Tests"
go test .\launchertester\ -timeout 15m -run TestBasicSetup --distro-name '${{ env.distroName }}' --launcher-name '${{ env.launcher }}'
go test .\launchertester\ -timeout 30m --distro-name '${{ env.distroName }}' --launcher-name '${{ env.launcher }}'
$exitStatus=$?
Write-Output "::endgroup::"
if ( ! $exitStatus ) { Exit(1) }
Expand Down
4 changes: 4 additions & 0 deletions DistroLauncher/DistroLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ HRESULT InstallDistribution(bool createUser)
return hr;
}

if (Ubuntu::CheckInitTasks(g_wslApi, createUser)) {
return ERROR_SUCCESS;
}

// Create a user account.
if (createUser) {
Helpers::PrintMessage(MSG_CREATE_USER_PROMPT);
Expand Down
4 changes: 4 additions & 0 deletions DistroLauncher/DistroLauncher.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<ItemGroup>
<ClInclude Include="DistributionInfo.h" />
<ClInclude Include="Helpers.h" />
<ClInclude Include="Ubuntu\InitTasks.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
Expand All @@ -149,6 +150,9 @@
<ClCompile Include="DistributionInfo.cpp" />
<ClCompile Include="Helpers.cpp" />
<ClCompile Include="DistroLauncher.cpp" />
<ClCompile Include="Ubuntu\InitTasks.cpp">
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
Expand Down
6 changes: 6 additions & 0 deletions DistroLauncher/DistroLauncher.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<ClInclude Include="Helpers.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Ubuntu\*.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="DistroLauncher.cpp">
Expand All @@ -50,6 +53,9 @@
<ClCompile Include="DistributionInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Ubuntu\*.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="DistroLauncher.rc">
Expand Down
11 changes: 11 additions & 0 deletions DistroLauncher/Ubuntu/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BasedOnStyle: Google
---
Language: Cpp
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: All
ColumnLimit: 100
DerivePointerAlignment: false
InsertNewlineAtEOF: true
PointerAlignment: Left
# We need to keep stdafx.h as the first include of any cpp file.
SortIncludes: false
Loading
Loading