From a4bf0e412b43c659740d8db346fc44d6cdd62e45 Mon Sep 17 00:00:00 2001 From: Aishwarya Bhandari <37918412+aishwaryabh@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:13:13 -0700 Subject: [PATCH] Core tools release updates (trigger custom host after code mirror, sign func.exe and nethost.dll, and remove inproc subfolders for minified default version) (#3879) * trying to trigger pr build * removing pr trigger and custom path * testing out changes * testing out chagnes * adding comment * reverting changes for branch * removing double * * testing 1es template changes * forgot to add 1es as a repository * fixing publish step * removing code mirror custom step * adding sign step and add useDotnetTask * minified version should not have inproc6/inproc8 subdirectories * installing net9 and changing path * pipeline utilities to see if that works for install netsdk * install net9 * installing net6 as well * move sign step before copy * adding self-contained --- ...uild-core-tools-host-artifacts-windows.yml | 97 ++++---------- .../official/jobs/build-core-tools-host.yml | 123 ++++++++++++++++++ .../ArtifactAssembler.cs | 7 +- 3 files changed, 153 insertions(+), 74 deletions(-) create mode 100644 eng/ci/templates/official/jobs/build-core-tools-host.yml diff --git a/eng/ci/build-core-tools-host-artifacts-windows.yml b/eng/ci/build-core-tools-host-artifacts-windows.yml index 7503fa499..cd369a7b9 100644 --- a/eng/ci/build-core-tools-host-artifacts-windows.yml +++ b/eng/ci/build-core-tools-host-artifacts-windows.yml @@ -1,89 +1,40 @@ -trigger: - branches: - include: - - feature/oop-host - paths: - include: - - ./host/src/** +pr: none -pr: +trigger: branches: include: - feature/oop-host paths: include: - - ./host/src/** + - /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 -jobs: -- job: BuildCoreToolsHostWindows - displayName: '[Windows] Build CoreToolsHost' - pool: - vmImage: 'windows-latest' - - variables: +variables: - template: /ci/variables/cfs.yml@eng - templateContext: - outputParentDirectory: $(Build.ArtifactStagingDirectory) - outputs: - - output: pipelineArtifact - displayName: Publish CoreToolsHost packages - path: $(Build.ArtifactStagingDirectory)/_coreToolsHostPackagesWindows - artifact: _coreToolsHostPackagesWindows - - steps: - - pwsh: | - Import-Module "./pipelineUtilities.psm1" -Force - Install-Dotnet - displayName: 'Install .NET 9' - - task: DotnetCoreCLI@2 - displayName: Dotnet Publish (win-x64) - inputs: - command: publish - publishWebProjects: false - zipAfterPublish: false - arguments: -c Release -r win-x64 -o $(Build.SourcesDirectory)/pkg_output/windows/win-x64 - workingDirectory: $(Build.SourcesDirectory)/host/src/CoreToolsHost - - - task: DotnetCoreCLI@2 - displayName: Dotnet Publish (win-arm64) - inputs: - command: publish - publishWebProjects: false - zipAfterPublish: false - arguments: -c Release -r win-arm64 -o $(Build.SourcesDirectory)/pkg_output/windows/win-arm64 - workingDirectory: $(Build.SourcesDirectory)/host/src/CoreToolsHost - - - task: CopyFiles@2 - displayName: Copy files (win-x64) - inputs: - SourceFolder: $(Build.SourcesDirectory)/pkg_output/windows/win-x64 - # Publish output will include many other files. We only need func.exe & nethost.dll - Contents: | - func.exe - nethost.dll - TargetFolder: $(Build.ArtifactStagingDirectory)/_coreToolsHostPackagesWindows/win-x64 - - - task: CopyFiles@2 - displayName: Copy files (win-arm64) - inputs: - SourceFolder: $(Build.SourcesDirectory)/pkg_output/windows/win-arm64 - # Publish output will include many other files. We only need func.exe & nethost.dll - Contents: | - func.exe - nethost.dll - TargetFolder: $(Build.ArtifactStagingDirectory)/_coreToolsHostPackagesWindows/win-arm64 - - - task: PublishPipelineArtifact@1 - displayName: 'Publish CoreToolsHost packages artifact' - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/_coreToolsHostPackagesWindows' - artifact: 'drop-coretools-host-windows' - publishLocation: 'pipeline' \ No newline at end of file +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 \ No newline at end of file diff --git a/eng/ci/templates/official/jobs/build-core-tools-host.yml b/eng/ci/templates/official/jobs/build-core-tools-host.yml new file mode 100644 index 000000000..3ceb3bad9 --- /dev/null +++ b/eng/ci/templates/official/jobs/build-core-tools-host.yml @@ -0,0 +1,123 @@ +jobs: +- job: BuildCoreToolsHostWindows + displayName: '[Windows] Build CoreToolsHost' + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + + steps: + - task: UseDotNet@2 + inputs: + version: 9.x + includePreviewVersions: true + displayName: Install .NET 9 + - task: UseDotNet@2 + inputs: + version: 6.x + displayName: Install .NET 6 + + - task: DotnetCoreCLI@2 + displayName: Dotnet Publish (win-x64) + inputs: + command: publish + publishWebProjects: false + zipAfterPublish: false + arguments: -c Release -r win-x64 -o $(Build.SourcesDirectory)/pkg_output/windows/win-x64 --self-contained + workingDirectory: $(Build.SourcesDirectory)/host/src/CoreToolsHost + + - task: DotnetCoreCLI@2 + displayName: Dotnet Publish (win-arm64) + inputs: + command: publish + publishWebProjects: false + zipAfterPublish: false + arguments: -c Release -r win-arm64 -o $(Build.SourcesDirectory)/pkg_output/windows/win-arm64 --self-contained + workingDirectory: $(Build.SourcesDirectory)/host/src/CoreToolsHost + + - template: ci/sign-files.yml@eng + parameters: + displayName: 'Authenticode signing (dll) (win-arm64)' + folderPath: '$(Build.SourcesDirectory)/pkg_output/windows/win-arm64' + pattern: '*.dll, *.exe' + signType: inline + inlineOperation: | + [ + { + "KeyCode": "CP-230012", + "OperationCode": "SigntoolSign", + "Parameters": { + "OpusName": "Microsoft", + "OpusInfo": "http://www.microsoft.com", + "FileDigest": "/fd \"SHA256\"", + "PageHash": "/NPH", + "TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + }, + "ToolName": "sign", + "ToolVersion": "1.0" + }, + { + "KeyCode": "CP-230012", + "OperationCode": "SigntoolVerify", + "Parameters": {}, + "ToolName": "sign", + "ToolVersion": "1.0" + } + ] + + - template: ci/sign-files.yml@eng + parameters: + displayName: 'Authenticode signing (dll) (win-x64)' + folderPath: '$(Build.SourcesDirectory)/pkg_output/windows/win-x64' + pattern: '*.dll, *.exe' + signType: inline + inlineOperation: | + [ + { + "KeyCode": "CP-230012", + "OperationCode": "SigntoolSign", + "Parameters": { + "OpusName": "Microsoft", + "OpusInfo": "http://www.microsoft.com", + "FileDigest": "/fd \"SHA256\"", + "PageHash": "/NPH", + "TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + }, + "ToolName": "sign", + "ToolVersion": "1.0" + }, + { + "KeyCode": "CP-230012", + "OperationCode": "SigntoolVerify", + "Parameters": {}, + "ToolName": "sign", + "ToolVersion": "1.0" + } + ] + + - task: CopyFiles@2 + displayName: Copy files (win-x64) + inputs: + SourceFolder: $(Build.SourcesDirectory)/pkg_output/windows/win-x64 + # Publish output will include many other files. We only need func.exe & nethost.dll + Contents: | + func.exe + nethost.dll + TargetFolder: $(Build.ArtifactStagingDirectory)/_coreToolsHostPackagesWindows/win-x64 + + - task: CopyFiles@2 + displayName: Copy files (win-arm64) + inputs: + SourceFolder: $(Build.SourcesDirectory)/pkg_output/windows/win-arm64 + # Publish output will include many other files. We only need func.exe & nethost.dll + Contents: | + func.exe + nethost.dll + TargetFolder: $(Build.ArtifactStagingDirectory)/_coreToolsHostPackagesWindows/win-arm64 + + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - output: pipelineArtifact + path: $(Build.ArtifactStagingDirectory)/_coreToolsHostPackagesWindows + artifact: drop-coretools-host-windows \ No newline at end of file diff --git a/src/Azure.Functions.ArtifactAssembler/ArtifactAssembler.cs b/src/Azure.Functions.ArtifactAssembler/ArtifactAssembler.cs index 74f222a8b..010d3cc13 100644 --- a/src/Azure.Functions.ArtifactAssembler/ArtifactAssembler.cs +++ b/src/Azure.Functions.ArtifactAssembler/ArtifactAssembler.cs @@ -30,7 +30,6 @@ internal sealed class ArtifactAssembler /// /// The artifacts for which we want to pack out-of-proc core tools with it (along with inproc6 and inproc8 directories). - /// This dictionary contains the artifact name and the corresponding runtime identifier value. /// private readonly string[] _cliArtifacts = { @@ -248,6 +247,12 @@ private async Task CreateCliCoreToolsAsync() await Task.Run(() => FileUtilities.CopyDirectory(outOfProcArtifactDirPath, consolidatedArtifactDirPath)); Directory.Delete(outOfProcArtifactDirPath, true); + // If we are currently on the minified version of the artifacts, we do not want the inproc6/inproc8 subfolders + if (artifactName.Contains("min.win")) + { + continue; + } + // If we are running this for the first time, extract the directory path and out of proc version if (String.IsNullOrEmpty(inProc8ArtifactDirPath)) {