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

Custom Host Mac/Linux #4141

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
2d35b1b
Core Tools OOP Host (#3802)
aishwaryabh Sep 24, 2024
7b7abaf
Custom host changes for VS Scenario (#3831)
aishwaryabh Sep 24, 2024
16c1f35
Custom host release changes (#3838)
aishwaryabh Sep 25, 2024
f75e5c6
Fix build to remove uploadToStorage (#3839)
aishwaryabh Sep 26, 2024
4843e9f
Adding artifact assembler tool which consolidates the artifacts and p…
kshyju Sep 27, 2024
df4c712
Updating the artifact name to include "_inproc" suffix (#3849)
kshyju Sep 27, 2024
af0b5d4
Small refactor and new tests (#3835)
fabiocav Oct 1, 2024
e34d9e3
Add traits for e2e tests to use in final pipeline (#3841)
aishwaryabh Oct 2, 2024
141d259
Updating coretools to detect unsupported inproc6 sdk scenario (#3825)
surgupta-msft Oct 3, 2024
e43f802
Disabling CET compatiblity for custom host (#3860)
mattchenderson Oct 4, 2024
8050e4d
Adding a comment to document our CET configuration (#3862)
fabiocav Oct 4, 2024
802e6f2
Restructuring custom host to improve error handling (#3861)
mattchenderson Oct 4, 2024
6472670
Support comments and int values of FUNCTIONS_INPROC_NET8_ENABLED (#3866)
mattchenderson Oct 7, 2024
70f8d06
Create Artifacts for releasing OOP core tools (#3848)
aishwaryabh Oct 7, 2024
d2ac557
allow trailing commas (#3870)
aishwaryabh Oct 8, 2024
dbf634e
Generating sha files for core tools artifacts (#3871)
soninaren Oct 8, 2024
a1906d1
Adding package reference (#3872)
aishwaryabh Oct 9, 2024
a089066
moving security vulnerability check to before build (#3877)
aishwaryabh Oct 10, 2024
6ee985b
Fixing custom host string comparison (#3880)
mattchenderson Oct 11, 2024
ca526b9
Templates version update (#3883)
surgupta-msft Oct 15, 2024
c44e837
Create metadata.json file in conslidated artifacts intermediate pipel…
aishwaryabh Oct 17, 2024
a4bf0e4
Core tools release updates (trigger custom host after code mirror, si…
aishwaryabh Oct 18, 2024
9422119
add rid in pipline and artifact assembley
aishwaryabh Oct 23, 2024
d215815
testing out linux build change
aishwaryabh Oct 23, 2024
2c7665c
osx
aishwaryabh Oct 23, 2024
37fc8e1
corecting mac pipeilne and fix linux sign
aishwaryabh Oct 23, 2024
4d0c20a
aot
aishwaryabh Oct 23, 2024
aacc08f
reverting aot change lol
aishwaryabh Oct 24, 2024
0b8e347
changing image name
aishwaryabh Oct 24, 2024
df0eb98
change mac sign and remove apt call
aishwaryabh Oct 24, 2024
3bff052
signing files
aishwaryabh Oct 24, 2024
20ff939
add sudo
aishwaryabh Oct 24, 2024
7f7262a
fixing linux script
aishwaryabh Oct 24, 2024
bd5f23b
deb files
aishwaryabh Oct 24, 2024
cee94d0
add commit id for metadata file (#4132)
aishwaryabh Oct 28, 2024
9e332b2
installing net4
aishwaryabh Oct 28, 2024
568cb63
removing net4 lol
aishwaryabh Oct 28, 2024
e0360e6
trying to add path
aishwaryabh Oct 28, 2024
fa71c7a
trying to get mac signing working
aishwaryabh Oct 28, 2024
b37118f
changing path for mac
aishwaryabh Oct 28, 2024
79d1781
changing mac again to remove chmod
aishwaryabh Oct 28, 2024
107f504
NPM publish update (#4133)
aishwaryabh Oct 28, 2024
67cb3df
signing change
aishwaryabh Oct 29, 2024
77ebfea
linux was signed ugh
aishwaryabh Oct 29, 2024
6408665
remove linux script
aishwaryabh Oct 29, 2024
1ed17ed
Trying to pubilsh each artifact and delete at end
aishwaryabh Oct 30, 2024
50a5923
changing artifact directory to source
aishwaryabh Oct 30, 2024
6be2c7b
specifying sub folder
aishwaryabh Oct 30, 2024
bac782a
fix directory structure
aishwaryabh Oct 30, 2024
3897f17
Update Chocolatey script for CDN download (#4137)
aishwaryabh Oct 30, 2024
68edca3
fixing bug (#4138)
aishwaryabh Oct 30, 2024
67e9668
Add CLI artifact zipper (#4139)
aishwaryabh Nov 1, 2024
e22966d
dont sign func
aishwaryabh Nov 1, 2024
f7470b8
changing sign type to dll
aishwaryabh Nov 1, 2024
f5954bc
removing sign thing
aishwaryabh Nov 1, 2024
db88cf8
trying linux signagain
aishwaryabh Nov 4, 2024
1cb61f1
removing signing all together
aishwaryabh Nov 5, 2024
2767a96
Merge branch 'feature/oop-host' of https://github.com/Azure/azure-fun…
aishwaryabh Nov 5, 2024
3aa7232
changing artifact assembler to account for 3 different artifacts for …
aishwaryabh Nov 5, 2024
d7654ba
changing extra file in mac
aishwaryabh Nov 5, 2024
afb579f
changing name of file
aishwaryabh Nov 6, 2024
b493450
adding delete file step
aishwaryabh Nov 6, 2024
776e2ec
remove delete step
aishwaryabh Nov 6, 2024
8b10726
just deleting core tools host folder
aishwaryabh Nov 6, 2024
dc18f46
adding logging and deleting extra files
aishwaryabh Nov 6, 2024
341f847
adding vs param
aishwaryabh Nov 7, 2024
cfac4b5
trying cli first
aishwaryabh Nov 7, 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
100 changes: 17 additions & 83 deletions build/BuildSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace Build
{
public static class BuildSteps
{
private const string Net8ArtifactNameSuffix = "_net8";
private static readonly string _wwwroot = Environment.ExpandEnvironmentVariables(@"%HOME%\site\wwwroot");
private static IntegrationTestBuildManifest _integrationManifest;

Expand Down Expand Up @@ -102,7 +101,7 @@ public static void DotnetPack()
Shell.Run("dotnet", $"pack {Settings.SrcProjectPath} " +
$"/p:BuildNumber=\"{Settings.BuildNumber}\" " +
$"/p:NoWorkers=\"true\" " +
$"/p:TargetFramework=net6.0 " + // without TargetFramework, the generated nuspec has incorrect path for the copy files operation.
$"/p:TargetFramework=net8.0 " + // without TargetFramework, the generated nuspec has incorrect path for the copy files operation.
$"/p:CommitHash=\"{Settings.CommitId}\" " +
(string.IsNullOrEmpty(Settings.IntegrationBuildNumber) ? string.Empty : $"/p:IntegrationBuildNumber=\"{Settings.IntegrationBuildNumber}\" ") +
$"-o {outputPath} -c Release --no-build");
Expand All @@ -116,17 +115,12 @@ public static void DotnetPublishForZips()
var outputPath = Path.Combine(Settings.OutputDir, runtime);
var rid = GetRuntimeId(runtime);

ExecuteDotnetPublish(outputPath, rid, "net6.0", skipLaunchingNet8ChildProcess: isMinVersion);

ExecuteDotnetPublish(outputPath, rid, "net8.0");
if (isMinVersion)
{
RemoveLanguageWorkers(outputPath);
CreateMinConfigurationFile(outputPath);
}

// Publish net8 version of the artifact as well.
var outputPathNet8 = BuildNet8ArtifactFullPath(runtime);
ExecuteDotnetPublish(outputPathNet8, rid, "net8.0", skipLaunchingNet8ChildProcess: true);
RemoveLanguageWorkers(outputPathNet8);
}

if (!string.IsNullOrEmpty(Settings.IntegrationBuildNumber) && (_integrationManifest != null))
Expand All @@ -135,18 +129,10 @@ public static void DotnetPublishForZips()
}
}

private static string BuildNet8ArtifactFullPath(string runtime)
{
return Path.Combine(Settings.OutputDir, BuildNet8ArtifactDirectory(runtime));
}

private static string BuildNet8ArtifactDirectory(string runtime) => $"{runtime}{Net8ArtifactNameSuffix}";

private static void ExecuteDotnetPublish(string outputPath, string rid, string targetFramework, bool skipLaunchingNet8ChildProcess)
private static void ExecuteDotnetPublish(string outputPath, string rid, string targetFramework)
{
Shell.Run("dotnet", $"publish {Settings.ProjectFile} " +
$"/p:BuildNumber=\"{Settings.BuildNumber}\" " +
$"/p:SkipInProcessHost=\"{skipLaunchingNet8ChildProcess}\" " +
$"/p:CommitHash=\"{Settings.CommitId}\" " +
(string.IsNullOrEmpty(Settings.IntegrationBuildNumber) ? string.Empty : $"/p:IntegrationBuildNumber=\"{Settings.IntegrationBuildNumber}\" ") +
$"-o {outputPath} -c Release -f {targetFramework} --self-contained" +
Expand Down Expand Up @@ -342,7 +328,7 @@ public static void Test()

Environment.SetEnvironmentVariable("DURABLE_FUNCTION_PATH", Settings.DurableFolder);

Shell.Run("dotnet", $"test {Settings.TestProjectFile} -f net6.0 --logger trx");
Shell.Run("dotnet", $"test {Settings.TestProjectFile} -f net8.0 --logger trx");
}

public static void CopyBinariesToSign()
Expand Down Expand Up @@ -568,11 +554,6 @@ public static void Zip()
var zipPath = Path.Combine(Settings.OutputDir, $"Azure.Functions.Cli.{runtime}.{version}.zip");
CreateZipFromArtifact(artifactPath, zipPath);

// Zip the .net8 version as well.
var net8Path = BuildNet8ArtifactFullPath(runtime);
var net8ZipPath = Path.Combine(Settings.OutputDir, $"Azure.Functions.Cli.{runtime}{Net8ArtifactNameSuffix}.{version}.zip");
CreateZipFromArtifact(net8Path, net8ZipPath);


// We leave the folders beginning with 'win' to generate the .msi files. They will be deleted in
// the ./generateMsiFiles.ps1 script
Expand All @@ -581,7 +562,6 @@ public static void Zip()
try
{
Directory.Delete(artifactPath, recursive: true);
Directory.Delete(net8Path, recursive: true);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -615,7 +595,7 @@ public static void GenerateSBOMManifestForZips()
Directory.CreateDirectory(Settings.SBOMManifestTelemetryDir);
// Generate the SBOM manifest for each artifactDirectory

var allArtifactDirectories = Settings.TargetRuntimes.Concat(Settings.TargetRuntimes.Select(r => BuildNet8ArtifactDirectory(r)));
var allArtifactDirectories = Settings.TargetRuntimes.Concat(Settings.TargetRuntimes);

foreach (var artifactDirectory in allArtifactDirectories)
{
Expand Down Expand Up @@ -643,10 +623,10 @@ public static void DotnetPublishForNupkg()
Shell.Run("dotnet", $"publish {Settings.ProjectFile} " +
$"/p:BuildNumber=\"{Settings.BuildNumber}\" " +
$"/p:NoWorkers=\"true\" " +
$"/p:TargetFramework=net6.0 " +
$"/p:TargetFramework=net8.0 " +
$"/p:CommitHash=\"{Settings.CommitId}\" " +
(string.IsNullOrEmpty(Settings.IntegrationBuildNumber) ? string.Empty : $"/p:IntegrationBuildNumber=\"{Settings.IntegrationBuildNumber}\" ") +
$"-c Release -f net6.0");
$"-c Release -f net8.0");
}

public static void GenerateSBOMManifestForNupkg()
Expand All @@ -673,55 +653,6 @@ public static void DeleteSBOMTelemetryFolder()
Directory.Delete(Settings.SBOMManifestTelemetryDir, recursive: true);
}

public static void UploadToStorage()
{
// Don't upload for public build.
if (Settings.IsPublicBuild)
{
ColoredConsole.WriteLine($"Skipping upload for public build.");
return;
}

ColoredConsole.WriteLine($"Going to run the UploadToStorage. Setting is {Settings.IsPublicBuild}");


if (!string.IsNullOrEmpty(Settings.BuildArtifactsStorage))
{
var version = new Version(CurrentVersion);
var storageAccount = CloudStorageAccount.Parse(Settings.BuildArtifactsStorage);
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("builds");
container.CreateIfNotExistsAsync().Wait();

container.SetPermissionsAsync(new BlobContainerPermissions
{
PublicAccess = BlobContainerPublicAccessType.Blob
});

foreach (var file in Directory.GetFiles(Settings.OutputDir, "Azure.Functions.Cli.*", SearchOption.TopDirectoryOnly))
{
var fileName = Path.GetFileName(file);
ColoredConsole.Write($"Uploading {fileName}...");

var versionedBlob = container.GetBlockBlobReference($"{version.ToString()}/{fileName}");
var latestBlob = container.GetBlockBlobReference($"{version.Major}/latest/{fileName.Replace($".{version.ToString()}", string.Empty)}");
versionedBlob.UploadFromFileAsync(file).Wait();
latestBlob.StartCopyAsync(versionedBlob).Wait();

ColoredConsole.WriteLine("Done");
}

var latestVersionBlob = container.GetBlockBlobReference($"{version.Major}/latest/version.txt");
latestVersionBlob.UploadTextAsync(version.ToString()).Wait();
}
else
{
var error = $"{nameof(Settings.BuildArtifactsStorage)} is null or empty. Can't run {nameof(UploadToStorage)} target";
ColoredConsole.Error.WriteLine(error.Red());
throw new Exception(error);
}
}

public static void LogIntoAzure()
{
var directoryId = Environment.GetEnvironmentVariable("AZURE_DIRECTORY_ID");
Expand Down Expand Up @@ -749,17 +680,15 @@ public static void LogIntoAzure()
private static IEnumerable<string> GetAllTargetRuntimes()
{
var targetRuntimes = Settings.TargetRuntimes;
var net8Runtimes = targetRuntimes.Select(r => BuildNet8ArtifactDirectory(r));

return targetRuntimes.Concat(net8Runtimes);
return targetRuntimes;
}

private static IEnumerable<string> GetAllRuntimesToSign()
{
var runtimeToSign = Settings.SignInfo.RuntimesToSign;
var net8Runtimes = runtimeToSign.Select(r => BuildNet8ArtifactDirectory(r));

return runtimeToSign.Concat(net8Runtimes);
return runtimeToSign;
}

public static void AddGoZip()
Expand All @@ -777,8 +706,6 @@ public static void AddGoZip()
foreach (var runtime in combinedRuntimesToSign)
{
var runtimeId = GetRuntimeId(runtime);
// Remove the Net8ArtifactNameSuffix suffix if present
runtimeId = runtimeId.Replace(Net8ArtifactNameSuffix, "");
if (runtimeToGoEnv.TryGetValue(runtimeId, out var goEnv))
{
Environment.SetEnvironmentVariable("CGO_ENABLED", "0");
Expand Down Expand Up @@ -842,6 +769,13 @@ private static void RemoveLanguageWorkers(string outputPath)
}
}

private static void CreateMinConfigurationFile(string outputPath)
{
var filePath = Path.Combine(outputPath, "artifactsconfig.json");
string artifactsJsonContent = "{\"minifiedVersion\": true}";
File.WriteAllTextAsync(filePath, artifactsJsonContent).GetAwaiter().GetResult();
}

private static PackageInfo GetLatestPackageInfo(string name, string majorVersion, string source)
{
string includeAllVersion = !string.IsNullOrWhiteSpace(majorVersion) ? "-AllVersions" : string.Empty;
Expand Down
1 change: 0 additions & 1 deletion build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ static void Main(string[] args)
.Then(DotnetPublishForNupkg)
.Then(DotnetPack)
.Then(CreateIntegrationTestsBuildManifest, skip: !args.Contains("--integrationTests"))
.Then(UploadToStorage, skip: !args.Contains("--ci"))
.Run();
}
}
Expand Down
18 changes: 14 additions & 4 deletions build/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ private static string config(string @default = null, [CallerMemberName] string k
: value;
}

public const string DotnetIsolatedItemTemplatesVersion = "4.0.3062";
public const string DotnetIsolatedProjectTemplatesVersion = "4.0.3062";
public const string DotnetItemTemplatesVersion = "4.0.3038";
public const string DotnetProjectTemplatesVersion = "4.0.3038";
public const string DotnetIsolatedItemTemplatesVersion = "4.0.5032";
public const string DotnetIsolatedProjectTemplatesVersion = "4.0.5032";
public const string DotnetItemTemplatesVersion = "4.0.5032";
public const string DotnetProjectTemplatesVersion = "4.0.5032";
public const string TemplateJsonVersion = "3.1.1648";

public static readonly string SBOMManifestToolPath = Path.GetFullPath("../ManifestTool/Microsoft.ManifestTool.dll");
Expand Down Expand Up @@ -341,6 +341,16 @@ public class SignInfo
"Microsoft.OData.Edm.dll",
"Microsoft.Spatial.dll",
"Mono.Posix.NETStandard.dll",
"OpenTelemetry.Api.dll",
"OpenTelemetry.Api.ProviderBuilderExtensions.dll",
"OpenTelemetry.dll",
"OpenTelemetry.Exporter.Console.dll",
"OpenTelemetry.Exporter.OpenTelemetryProtocol.dll",
"OpenTelemetry.Extensions.Hosting.dll",
"OpenTelemetry.Instrumentation.AspNetCore.dll",
"OpenTelemetry.Instrumentation.Http.dll",
"OpenTelemetry.PersistentStorage.Abstractions.dll",
"OpenTelemetry.PersistentStorage.FileSystem.dll",
Path.Combine("tools", "python", "packapp", "distlib")
};
}
Expand Down
1 change: 1 addition & 0 deletions code-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ trigger:
- release_4.0
- release_3.0
- release_4.0_hotfix
- feature/*

resources:
repositories:
Expand Down
40 changes: 40 additions & 0 deletions eng/ci/build-core-tools-host-artifacts-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
pr: none

trigger:
branches:
include:
- feature/oop-host
paths:
include:
- /host/src/**

resources:
repositories:
- repository: 1es
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
- repository: eng
type: git
name: engineering
ref: refs/tags/release

variables:
- template: /ci/variables/cfs.yml@eng

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1es
parameters:
pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows
sdl:
codeql:
compiled:
enabled: true
runSourceLanguagesInSourceAnalysis: true
stages:
- stage: BuildCoreToolsHost
jobs:
- template: /eng/ci/templates/official/jobs/build-core-tools-host.yml@self
1 change: 1 addition & 0 deletions eng/ci/official-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ trigger:
include:
- v4.x
- release_4.0
- feature/*

resources:
repositories:
Expand Down
2 changes: 2 additions & 0 deletions eng/ci/public-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ pr:
include:
- v4.x
- release_4.0
- feature/*

trigger:
batch: true
branches:
include:
- v4.x
- release_4.0
- feature/*

resources:
repositories:
Expand Down
Loading