Skip to content

Commit 9eb49ea

Browse files
committed
Add alpine source build CI leg
1 parent 359d6cd commit 9eb49ea

File tree

5 files changed

+59
-8
lines changed

5 files changed

+59
-8
lines changed

eng/pipelines/templates/stages/vmr-build.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ parameters:
1313

1414
# The following parameters aren't expected to be passed in rather they are used for encapsulation
1515
# -----------------------------------------------------------------------------------------------
16+
alpine317Container: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17
1617
centOSStream8Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8
1718
centOSStream9Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9
1819
debian11Arm64Container: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-arm64v8
@@ -82,6 +83,24 @@ stages:
8283
runOnline: true #
8384
withPreviousSDK: false # 🚫
8485

86+
# TODO: Move within ne(variables['Build.Reason'], 'PullRequest') block after tested in PR validation
87+
- template: ../jobs/vmr-build.yml
88+
parameters:
89+
buildName: Alpine317_Offline_MsftSdk
90+
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
91+
vmrBranch: ${{ variables.VmrBranch }}
92+
architecture: x64
93+
pool:
94+
name: ${{ variables.defaultPoolName }}
95+
demands: ${{ variables.defaultPoolDemands }}
96+
container: ${{ parameters.alpine317Container }}
97+
buildFromArchive: true #
98+
enablePoison: false # 🚫
99+
excludeOmniSharpTests: true #
100+
overrideDistroDisablingSha1: false # 🚫
101+
runOnline: false # 🚫
102+
withPreviousSDK: false # 🚫
103+
85104
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
86105
- template: ../jobs/vmr-build.yml
87106
parameters:

src/SourceBuild/content/eng/bootstrap/buildBootstrapPreviouslySB.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
<ItemGroup>
1616
<!-- These packages will be replaced with ms-built packages downloaded from official package feeds-->
1717
<PackageDownload Include="Microsoft.Aspnetcore.App.Runtime.linux-x64" Version="[$(MicrosoftAspNetCoreAppRuntimeVersion)]" />
18+
<PackageDownload Include="Microsoft.AspNetCore.App.Runtime.linux-musl-x64" Version="[$(MicrosoftAspNetCoreAppRuntimeVersion)]" />
1819
<PackageDownload Include="Microsoft.NETCore.App.Crossgen2.linux-x64" Version="[$(MicrosoftNETCoreAppCrossgen2Version)]" />
20+
<PackageDownload Include="Microsoft.NETCore.App.Crossgen2.linux-musl-x64" Version="[$(MicrosoftNETCoreAppCrossgen2Version)]" />
1921
<PackageDownload Include="Microsoft.NETCore.App.Host.linux-x64" Version="[$(MicrosoftNETCoreAppHostPackageVersion)]" />
22+
<PackageDownload Include="Microsoft.NETCore.App.Host.linux-musl-x64" Version="[$(MicrosoftNETCoreAppHostPackageVersion)]" />
2023
<PackageDownload Include="Microsoft.NETCore.App.Runtime.linux-x64" Version="[$(MicrosoftNETCoreAppRuntimeVersion)]" />
24+
<PackageDownload Include="Microsoft.NETCore.App.Runtime.linux-musl-x64" Version="[$(MicrosoftNETCoreAppRuntimeVersion)]" />
2125
<PackageDownload Include="Microsoft.NET.HostModel" Version="[$(MicrosoftNETHostModelVersion)]" />
2226
<PackageDownload Include="Microsoft.NET.Sdk.IL" Version="[$(MicrosoftNETSdkILVersion)]" />
2327
<PackageDownload Include="Microsoft.NETCore.ILAsm" Version="[$(MicrosoftNETCoreILAsmVersion)]" />

src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12+
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="7.0.0" />
1213
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
1314
<PackageReference Include="xunit" Version="2.4.1" />
1415
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">

src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SourceBuiltArtifactsTests.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
using System;
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
26
using System.Collections.Generic;
37
using System.IO;
48
using System.Linq;
@@ -21,7 +25,7 @@ public void VerifyVersionFile()
2125
try
2226
{
2327
// Extract the .version file
24-
ExtractFileFromTarball(Config.SourceBuiltArtifactsPath, ".version", outputDir);
28+
Utilities.ExtractFileFromTarball(Config.SourceBuiltArtifactsPath, ".version", outputDir);
2529

2630
string[] versionLines = File.ReadAllLines(Path.Combine(outputDir, ".version"));
2731
Assert.Equal(2, versionLines.Length);
@@ -47,7 +51,7 @@ public void VerifyVersionFile()
4751
string sdkVersion = versionLines[1];
4852

4953
// Find the expected SDK version by getting it from the SDK tarball
50-
ExtractFileFromTarball(Config.SdkTarballPath, "./sdk/*/.version", outputDir);
54+
Utilities.ExtractFileFromTarball(Config.SdkTarballPath, "./sdk/*/.version", outputDir);
5155
DirectoryInfo sdkDir = new DirectoryInfo(Path.Combine(outputDir, "sdk"));
5256
string sdkVersionPath = sdkDir.GetFiles(".version", SearchOption.AllDirectories).Single().FullName;
5357
string[] sdkVersionLines = File.ReadAllLines(Path.Combine(outputDir, sdkVersionPath));
@@ -60,9 +64,4 @@ public void VerifyVersionFile()
6064
Directory.Delete(outputDir, recursive: true);
6165
}
6266
}
63-
64-
private void ExtractFileFromTarball(string tarballPath, string filePath, string outputDir)
65-
{
66-
ExecuteHelper.ExecuteProcessValidateExitCode("tar", $"--wildcards -xzf {tarballPath} -C {outputDir} {filePath}", OutputHelper);
67-
}
6867
}

src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Utilities.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using Microsoft.Extensions.FileSystemGlobbing;
56
using System;
7+
using System.Formats.Tar;
8+
using System.IO;
9+
using System.IO.Compression;
610
using System.Threading;
711
using System.Threading.Tasks;
812
using Xunit.Abstractions;
@@ -11,6 +15,30 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests;
1115

1216
public static class Utilities
1317
{
18+
public static void ExtractFileFromTarball(string tarballPath, string filePath, string outputDir)
19+
{
20+
Matcher matcher = new();
21+
matcher.AddInclude(filePath);
22+
23+
using FileStream fileStream = File.OpenRead(tarballPath);
24+
using GZipStream decompressorStream = new(fileStream, CompressionMode.Decompress);
25+
using TarReader reader = new(decompressorStream);
26+
27+
TarEntry entry;
28+
while ((entry = reader.GetNextEntry()) is not null)
29+
{
30+
if (matcher.Match(entry.Name).HasMatches)
31+
{
32+
string outputPath = Path.Join(outputDir, entry.Name);
33+
Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
34+
35+
using FileStream outputFileStream = File.Create(outputPath);
36+
entry.DataStream.CopyTo(outputFileStream);
37+
break;
38+
}
39+
}
40+
}
41+
1442
public static async Task RetryAsync(Func<Task> executor, ITestOutputHelper outputHelper)
1543
{
1644
await Utilities.RetryAsync(

0 commit comments

Comments
 (0)