Skip to content

Enable container tests #48910

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

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
617171a
Set additional environment variables
v-wuzhai May 6, 2025
f36523b
Attempt to enable local DOTNET_CLI_HOME to avoid read-only filesystem…
v-wuzhai May 8, 2025
463da35
Set full path
v-wuzhai May 8, 2025
437c64d
Add more logs
v-wuzhai May 9, 2025
606eb02
User DOTNET_CLI_HOME
v-wuzhai May 9, 2025
c6b29d3
fix
v-wuzhai May 9, 2025
f154121
fix
v-wuzhai May 12, 2025
ee7b3db
Capital letters
v-wuzhai May 12, 2025
5b93115
Update
v-wuzhai May 12, 2025
1609ba2
update
v-wuzhai May 13, 2025
e0893a6
update
v-wuzhai May 13, 2025
2f62d1f
Update
v-wuzhai May 13, 2025
47c7eb6
skip
v-wuzhai May 13, 2025
cba7965
Enable other containers for testing
v-wuzhai May 19, 2025
033e097
Update
v-wuzhai May 19, 2025
3f8bc0a
Update
v-wuzhai May 19, 2025
4d17a93
Update
v-wuzhai May 19, 2025
8e22e90
debug
v-wuzhai May 20, 2025
8f9f9d2
update
v-wuzhai May 20, 2025
edefedc
update
v-wuzhai May 20, 2025
98ca74f
update
v-wuzhai May 20, 2025
44c5e79
update
v-wuzhai May 21, 2025
a61a001
update
v-wuzhai May 21, 2025
a7d089e
update
v-wuzhai May 21, 2025
7df9309
update
v-wuzhai May 21, 2025
3b8329e
update
v-wuzhai May 21, 2025
b978376
update
v-wuzhai May 22, 2025
a2968de
update
v-wuzhai May 22, 2025
4892893
Merge branch 'main' of https://github.com/dotnet/sdk into dev/Jason/d…
v-wuzhai May 22, 2025
e578d6c
update
v-wuzhai May 23, 2025
1d07ffa
update
v-wuzhai May 23, 2025
19bd1eb
update
v-wuzhai May 26, 2025
51d5de3
update
v-wuzhai May 26, 2025
c4b3ff4
update
v-wuzhai May 27, 2025
47c92f8
update
v-wuzhai May 27, 2025
aed246a
update
v-wuzhai May 28, 2025
cfbc540
update
v-wuzhai May 28, 2025
2d7d1c3
update
v-wuzhai May 28, 2025
d59ce32
update
v-wuzhai May 29, 2025
94cdd87
update
v-wuzhai May 29, 2025
a20ce31
debug
v-wuzhai Jun 3, 2025
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
41 changes: 41 additions & 0 deletions build/RunTestsOnHelix.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
#!/usr/bin/env bash

install_dependencies() {
echo "Installing dependencies..."

if [ -f /etc/os-release ]; then
. /etc/os-release
echo "Detected OS: $ID $VERSION_ID"

case "$ID" in
centos)
sudo dnf install -y epel-release || echo "Warning: Failed to install epel-release"
sudo dnf install -y zlib-devel libunwind || echo "Warning: Failed to install zlib-devel or libunwind"
;;

fedora)
sudo dnf install -y zlib-devel clang icu libicu libicu-devel || echo "Warning: Failed to install zlib-devel or clang"
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH
sudo ldconfig
echo "Verifying ICU installation..."
if ldconfig -p | grep libicu; then
echo "ICU libraries found."
else
echo "ICU libraries not found in ldconfig. You may need to check your installation."
fi
echo ".NET Info:"
dotnet --info
;;

alpine)
sudo apk add --no-cache zlib-dev musl-dev clang || echo "Warning: Failed to install zlib-dev, musl-dev or clang"
;;
esac
else
echo "Notice: /etc/os-release not found. Skipping dependency installation."
fi

echo "Dependencies installation complete."
}

install_dependencies

# make NuGet network operations more robust
export NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true
export NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT=6
Expand Down
17 changes: 5 additions & 12 deletions eng/pipelines/templates/jobs/sdk-job-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,14 @@ parameters:
runTests: true
- categoryName: ContainerBased
container: fedora39
# No fedora Helix container is available, so use the ubuntu one instead.
helixTargetContainer: $(helixTargetContainerPrefix)ubuntu-22.04-helix-amd64
helixTargetContainer: $(helixTargetContainerPrefix)fedora-41-helix-amd64
osProperties: $(linuxOsPortableProperties)
# Skipping all container-based testing for now.
# See: https://github.com/dotnet/sdk/issues/40935
runTests: false
runTests: true
- categoryName: ContainerBased
container: centosStream9
helixTargetContainer: $(helixTargetContainerPrefix)centos-stream9-helix
osProperties: /p:OSName=linux
# Skipping all container-based testing for now.
# See: https://github.com/dotnet/sdk/issues/40935
runTests: false
runTests: true
- categoryName: ContainerBased
container: debian12Amd64
helixTargetContainer: $(helixTargetContainerPrefix)debian-11-helix-amd64
Expand All @@ -58,12 +53,10 @@ parameters:
helixTargetContainer: $(helixTargetContainerPrefix)alpine-3.18-helix-amd64
runtimeIdentifier: linux-musl-x64
# Use HostOSName when running on alpine.
osProperties: /p:HostOSName=linux-musl
osProperties: /p:HostOSName=linux-musl /p:UseCrossgen2=true
# SBOM generation is not supported for alpine.
enableSbom: false
# Skipping all container-based testing for now.
# See: https://github.com/dotnet/sdk/issues/40935
runTests: false
runTests: true
- categoryName: TemplateEngine
osProperties: $(linuxOsPortableProperties)
testProjects: $(Build.SourcesDirectory)/test/Microsoft.TemplateEngine.Cli.UnitTests/Microsoft.TemplateEngine.Cli.UnitTests.csproj;$(Build.SourcesDirectory)/test/dotnet-new.IntegrationTests/dotnet-new.IntegrationTests.csproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public GivenThatWeWantToBuildASelfContainedApp(ITestOutputHelper log) : base(log
[Theory]
[InlineData("netcoreapp1.1", false)]
[InlineData("netcoreapp2.0", false)]
[InlineData("netcoreapp3.0", true)]
[InlineData(ToolsetInfo.CurrentTargetFramework, true)]
public void It_builds_a_runnable_output(string targetFramework, bool dependenciesIncluded)
{
if (!EnvironmentInfo.SupportsTargetFramework(targetFramework))
Expand Down
66 changes: 14 additions & 52 deletions test/Microsoft.NET.TestFramework/EnvironmentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,70 +101,32 @@ public static bool SupportsTargetFramework(string targetFramework)
return false;
}
}
else if (osId.Equals("debian", StringComparison.OrdinalIgnoreCase))
else if (osId.Equals("centos", StringComparison.OrdinalIgnoreCase))
{
if (nugetFramework.Version < new Version(2, 0, 0, 0))
{
return false;
}
}
else if (Version.TryParse(versionString, out Version? osVersion))
else if (osId.Equals("debian", StringComparison.OrdinalIgnoreCase))
{
if (osId.Equals("fedora", StringComparison.OrdinalIgnoreCase))
if (nugetFramework.Version < new Version(2, 0, 0, 0))
{
if (osVersion.Major <= 27)
{
if (nugetFramework.Version < new Version(2, 1, 0, 0))
{
return true;
}
else
{
return false;
}
}
else if (osVersion.Major == 28)
{
if (nugetFramework.Version < new Version(2, 1, 0, 0))
{
return false;
}
else
{
return true;
}
}
else if (osVersion.Major >= 29)
{
if (nugetFramework.Version < new Version(2, 2, 0, 0))
{
return false;
}
else
{
return true;
}
}
return false;
}
else if (osId.Equals("rhel", StringComparison.OrdinalIgnoreCase))
}
else if (osId.Equals("fedora", StringComparison.OrdinalIgnoreCase))
{
if (nugetFramework.Version < new Version(2, 2, 0, 0))
{
if (osVersion.Major == 6)
{
if (nugetFramework.Version < new Version(2, 0, 0, 0))
{
return false;
}
}
return false;
}
else if (osId.Equals("ubuntu", StringComparison.OrdinalIgnoreCase))
}
else if (osId.Equals("ubuntu", StringComparison.OrdinalIgnoreCase))
{
if (nugetFramework.Version < new Version(2, 0, 0, 0))
{
if (osVersion > new Version(16, 04))
{
if (nugetFramework.Version < new Version(2, 0, 0, 0))
{
return false;
}
}
return false;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.DotNet.Cli.Workload.Restore.Tests;
Expand Down Expand Up @@ -60,6 +60,16 @@ public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBr

private bool IsRunningInContainer()
{
return File.Exists("/.dockerenv") && (RuntimeInformation.OSDescription.Contains("Ubuntu") || RuntimeInformation.OSDescription.Contains("Debian"));
if (!File.Exists("/.dockerenv"))
{
return false;
}

string osDescription = RuntimeInformation.OSDescription.ToLowerInvariant();
return osDescription.Contains("alpine") ||
osDescription.Contains("centos") ||
osDescription.Contains("debian") ||
osDescription.Contains("fedora") ||
osDescription.Contains("ubuntu");
}
}
Loading