From 161b30009095f2c63e2c5003d0b92835a690443c Mon Sep 17 00:00:00 2001 From: Bill Long Date: Thu, 27 Jun 2024 22:59:17 -0500 Subject: [PATCH] Update pipelines to use 1ES templates --- azure-pipeline-merge.yml | 156 ++++++++++----------- azure-pipeline-release.yml | 276 ++++++++++++++++++------------------- 2 files changed, 206 insertions(+), 226 deletions(-) diff --git a/azure-pipeline-merge.yml b/azure-pipeline-merge.yml index 1481c9c2..062b3be2 100644 --- a/azure-pipeline-merge.yml +++ b/azure-pipeline-merge.yml @@ -1,83 +1,75 @@ +# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool. +# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected. +# This pipeline will be extended to the OneESPT template +# If you are not using the E+D shared hosted pool with windows-2022, replace the pool section with your hosted pool, os, and image name. If you are using a Linux image, you must specify an additional windows image for SDL: https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sdlanalysis/overview#how-to-specify-a-windows-pool-for-the-sdl-source-analysis-stage trigger: - - main - -pool: - vmImage: 'windows-latest' - -steps: -- task: UseDotNet@2 - displayName: 'Install .NET SDK' - inputs: - version: '8.x' - performMultiLevelLookup: true - -- script: dotnet workload restore src/EventLogExpert.sln - displayName: 'dotnet workload restore' - -- script: dotnet test src/EventLogExpert.sln - displayName: 'dotnet test' - -- pwsh: | - $now = [DateTime]::UtcNow - $versionString = "$($now.ToString(`"y.M.d`")).$($now.Hour * 60 + $now.Minute)" - Write-Host "##vso[task.setvariable variable=ReleaseVersion]$versionString" - Write-Host $versionString - displayName: 'create version string' - -- pwsh: | - echo "ReleaseVersion: $(ReleaseVersion)" - [xml]$manifest = Get-Content -Raw "src\EventLogExpert\Platforms\Windows\Package.appxmanifest" - $manifest.Package.Identity.Version = "$(ReleaseVersion)" - $manifest.Save("src\EventLogExpert\Platforms\Windows\Package.appxmanifest") - Get-Content "src\EventLogExpert\Platforms\Windows\Package.appxmanifest" - displayName: 'set version in manifest' - -- pwsh: > - dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj ` - --self-contained ` - -c Release ` - -o "$(build.artifactStagingDirectory)" ` - -p:IncludeNativeLibrariesForSelfExtract=true ` - -p:PublishSingleFile=true ` - -p:Version=$(ReleaseVersion) - displayName: 'dotnet publish EventDbTool' - -- pwsh: > - dotnet publish src/EventLogExpert/EventLogExpert.csproj ` - -c Release ` - -f net8.0-windows10.0.19041.0 ` - -p:AppxBundle=Never ` - -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` - -p:AppInstallerUpdateFrequency=1 ` - -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` - -p:GenerateAppInstallerFile=true ` - -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` - -p:RuntimeIdentifierOverride=win10-x64 ` - -p:UapAppxPackageBuildMode=SideLoadOnly ` - -p:Version=$(ReleaseVersion) - displayName: 'dotnet publish EventLogExpert' - -- pwsh: | - Get-ChildItem -Recurse "$(build.artifactStagingDirectory)" - displayName: 'show all files' - -- pwsh: | - Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\*.appinstaller" | % { Move-Item $_ "$(build.artifactStagingDirectory)" } - $msixFolder = Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\" -Directory - echo "msixFolder: $msixFolder" - Get-ChildItem $msixFolder *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" } - Get-ChildItem (Join-Path $msixFolder "\Dependencies\x64\") *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" } - displayName: 'move msix to staging directory' - -- pwsh: | - Get-ChildItem "$(build.artifactStagingDirectory)" - displayName: 'show staging directory' - -- pwsh: | - $appInstallerFile = Get-Item "$(build.artifactStagingDirectory)\*.appinstaller" - [xml]$appinstaller = Get-Content -Raw $appInstallerFile - $appInstaller.AppInstaller.MainPackage.Uri = $appInstaller.AppInstaller.MainPackage.Uri -replace "/download/(.*)/", "/download/" - $appInstaller.AppInstaller.Dependencies.Package.Uri = $appInstaller.AppInstaller.Dependencies.Package.Uri -replace "/download/(.*)/", "/download/" - $appInstaller.Save($appInstallerFile) - Get-Content $appInstallerFile - displayName: 'update appinstaller paths' +- main +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +extends: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + pool: + name: MSSecurity-1ES-Build-Agents-Pool + image: MSSecurity-1ES-Windows-2022 + os: windows + customBuildTags: + - ES365AIMigrationTooling + stages: + - stage: stage + jobs: + - job: job + steps: + - task: UseDotNet@2 + displayName: 'Install .NET SDK' + inputs: + version: '8.x' + performMultiLevelLookup: true + - script: dotnet workload restore src/EventLogExpert.sln + displayName: 'dotnet workload restore' + - script: dotnet test src/EventLogExpert.sln + displayName: 'dotnet test' + - pwsh: | + $now = [DateTime]::UtcNow + $versionString = "$($now.ToString(`"y.M.d`")).$($now.Hour * 60 + $now.Minute)" + Write-Host "##vso[task.setvariable variable=ReleaseVersion]$versionString" + Write-Host $versionString + displayName: 'create version string' + - pwsh: | + echo "ReleaseVersion: $(ReleaseVersion)" + [xml]$manifest = Get-Content -Raw "src\EventLogExpert\Platforms\Windows\Package.appxmanifest" + $manifest.Package.Identity.Version = "$(ReleaseVersion)" + $manifest.Save("src\EventLogExpert\Platforms\Windows\Package.appxmanifest") + Get-Content "src\EventLogExpert\Platforms\Windows\Package.appxmanifest" + displayName: 'set version in manifest' + - pwsh: > + dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj ` --self-contained ` -c Release ` -o "$(build.artifactStagingDirectory)" ` -p:IncludeNativeLibrariesForSelfExtract=true ` -p:PublishSingleFile=true ` -p:Version=$(ReleaseVersion) + displayName: 'dotnet publish EventDbTool' + - pwsh: > + dotnet publish src/EventLogExpert/EventLogExpert.csproj ` -c Release ` -f net8.0-windows10.0.19041.0 ` -p:AppxBundle=Never ` -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` -p:AppInstallerUpdateFrequency=1 ` -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` -p:GenerateAppInstallerFile=true ` -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` -p:RuntimeIdentifierOverride=win10-x64 ` -p:UapAppxPackageBuildMode=SideLoadOnly ` -p:Version=$(ReleaseVersion) + displayName: 'dotnet publish EventLogExpert' + - pwsh: | + Get-ChildItem -Recurse "$(build.artifactStagingDirectory)" + displayName: 'show all files' + - pwsh: | + Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\*.appinstaller" | % { Move-Item $_ "$(build.artifactStagingDirectory)" } + $msixFolder = Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\" -Directory + echo "msixFolder: $msixFolder" + Get-ChildItem $msixFolder *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" } + Get-ChildItem (Join-Path $msixFolder "\Dependencies\x64\") *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" } + displayName: 'move msix to staging directory' + - pwsh: | + Get-ChildItem "$(build.artifactStagingDirectory)" + displayName: 'show staging directory' + - pwsh: | + $appInstallerFile = Get-Item "$(build.artifactStagingDirectory)\*.appinstaller" + [xml]$appinstaller = Get-Content -Raw $appInstallerFile + $appInstaller.AppInstaller.MainPackage.Uri = $appInstaller.AppInstaller.MainPackage.Uri -replace "/download/(.*)/", "/download/" + $appInstaller.AppInstaller.Dependencies.Package.Uri = $appInstaller.AppInstaller.Dependencies.Package.Uri -replace "/download/(.*)/", "/download/" + $appInstaller.Save($appInstallerFile) + Get-Content $appInstallerFile + displayName: 'update appinstaller paths' \ No newline at end of file diff --git a/azure-pipeline-release.yml b/azure-pipeline-release.yml index 4b1998ce..d118870d 100644 --- a/azure-pipeline-release.yml +++ b/azure-pipeline-release.yml @@ -1,146 +1,134 @@ +# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool. +# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected. +# This pipeline will be extended to the OneESPT template +# If you are not using the E+D shared hosted pool with windows-2022, replace the pool section with your hosted pool, os, and image name. If you are using a Linux image, you must specify an additional windows image for SDL: https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sdlanalysis/overview#how-to-specify-a-windows-pool-for-the-sdl-source-analysis-stage trigger: none - pr: none - -pool: - vmImage: 'windows-latest' - -steps: -- task: UseDotNet@2 - displayName: 'Install .NET SDK' - inputs: - version: '8.x' - performMultiLevelLookup: true - -- script: dotnet workload restore src/EventLogExpert.sln - displayName: 'dotnet workload restore' - -- script: dotnet test src/EventLogExpert.sln - displayName: 'dotnet test' - -- pwsh: | - $now = [DateTime]::UtcNow - $versionString = "$($now.ToString(`"y.M.d`")).$($now.Hour * 60 + $now.Minute)" - Write-Host "##vso[task.setvariable variable=ReleaseVersion]$versionString" - Write-Host $versionString - displayName: 'create version string' - -- pwsh: | - echo "ReleaseVersion: $(ReleaseVersion)" - [xml]$manifest = Get-Content -Raw "src\EventLogExpert\Platforms\Windows\Package.appxmanifest" - $manifest.Package.Identity.Version = "$(ReleaseVersion)" - $manifest.Save("src\EventLogExpert\Platforms\Windows\Package.appxmanifest") - Get-Content "src\EventLogExpert\Platforms\Windows\Package.appxmanifest" - displayName: 'set version in manifest' - -- pwsh: > - dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj ` - --self-contained ` - -c Release ` - -o "$(build.artifactStagingDirectory)" ` - -p:IncludeNativeLibrariesForSelfExtract=true ` - -p:PublishSingleFile=true ` - -p:Version=$(ReleaseVersion) - displayName: 'dotnet publish EventDbTool' - -- pwsh: > - dotnet publish src/EventLogExpert/EventLogExpert.csproj ` - -c Release ` - -f net8.0-windows10.0.19041.0 ` - -p:AppxBundle=Never ` - -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` - -p:AppInstallerUpdateFrequency=1 ` - -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` - -p:GenerateAppInstallerFile=true ` - -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` - -p:RuntimeIdentifierOverride=win10-x64 ` - -p:UapAppxPackageBuildMode=SideLoadOnly ` - -p:Version=$(ReleaseVersion) - displayName: 'dotnet publish EventLogExpert' - -- pwsh: | - Get-ChildItem -Recurse "$(build.artifactStagingDirectory)" - displayName: 'show all files' - -- pwsh: | - Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\*.appinstaller" | % { Move-Item $_ "$(build.artifactStagingDirectory)" } - $msixFolder = Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\" -Directory - echo "msixFolder: $msixFolder" - Get-ChildItem $msixFolder *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" } - Get-ChildItem (Join-Path $msixFolder "\Dependencies\x64\") *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" } - displayName: 'move msix to staging directory' - -- pwsh: | - Get-ChildItem "$(build.artifactStagingDirectory)" - displayName: 'show staging directory' - -- pwsh: | - $appInstallerFile = Get-Item "$(build.artifactStagingDirectory)\*.appinstaller" - [xml]$appinstaller = Get-Content -Raw $appInstallerFile - $appInstaller.AppInstaller.MainPackage.Uri = $appInstaller.AppInstaller.MainPackage.Uri -replace "/download/(.*)/", "/download/" - $appInstaller.AppInstaller.Dependencies.Package.Uri = $appInstaller.AppInstaller.Dependencies.Package.Uri -replace "/download/(.*)/", "/download/" - $appInstaller.Save($appInstallerFile) - Get-Content $appInstallerFile - displayName: 'update appinstaller paths' - -- task: EsrpCodeSigning@2 - inputs: - ConnectedServiceName: 'ESRP CodeSign for EventLogExpert' - FolderPath: "$(build.artifactStagingDirectory)" - Pattern: 'EventLogExpert_*.msix,eventdbtool.exe' - signConfigType: 'inlineSignParams' - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ - { - "parameterName": "OpusName", - "parameterValue": "EventLogExpert" - }, - { - "parameterName": "OpusInfo", - "parameterValue": "https://github.com/microsoft/EventLogExpert" - }, - { - "parameterName": "PageHash", - "parameterValue": "/NPH" - }, - { - "parameterName": "FileDigest", - "parameterValue": "/fd sha256" - }, - { - "parameterName": "TimeStamp", - "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" - } - ], - "toolName": "signtool.exe", - "toolVersion": "6.2.9304.0" - } - ] - SessionTimeout: '60' - MaxConcurrency: '50' - MaxRetryAttempts: '5' - -- pwsh: | - Get-ChildItem "$(build.artifactStagingDirectory)\*.exe" | % { Compress-Archive $_ "$(build.artifactStagingDirectory)\$([IO.Path]::GetFilenameWithoutExtension($_.Name)).zip" } - displayName: zip eventdbtool.exe - -- task: GitHubRelease@1 - displayName: 'Create GitHub Release - Draft' - inputs: - gitHubConnection: 'github.com_eventlogexpert' - repositoryName: microsoft/EventLogExpert - action: create - tagSource: userSpecifiedTag - tagPattern: 'v$(ReleaseVersion)' - tag: v$(ReleaseVersion) - title: v$(ReleaseVersion) - assets: | - $(build.artifactStagingDirectory)\*.appinstaller - $(build.artifactStagingDirectory)\*.msix - $(build.artifactStagingDirectory)\*.zip - addChangeLog: true - isDraft: true +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + pool: + name: MSSecurity-1ES-Build-Agents-Pool + image: MSSecurity-1ES-Windows-2022 + os: windows + customBuildTags: + - ES365AIMigrationTooling + stages: + - stage: stage + jobs: + - job: job + steps: + - task: UseDotNet@2 + displayName: 'Install .NET SDK' + inputs: + version: '8.x' + performMultiLevelLookup: true + - script: dotnet workload restore src/EventLogExpert.sln + displayName: 'dotnet workload restore' + - script: dotnet test src/EventLogExpert.sln + displayName: 'dotnet test' + - pwsh: | + $now = [DateTime]::UtcNow + $versionString = "$($now.ToString(`"y.M.d`")).$($now.Hour * 60 + $now.Minute)" + Write-Host "##vso[task.setvariable variable=ReleaseVersion]$versionString" + Write-Host $versionString + displayName: 'create version string' + - pwsh: | + echo "ReleaseVersion: $(ReleaseVersion)" + [xml]$manifest = Get-Content -Raw "src\EventLogExpert\Platforms\Windows\Package.appxmanifest" + $manifest.Package.Identity.Version = "$(ReleaseVersion)" + $manifest.Save("src\EventLogExpert\Platforms\Windows\Package.appxmanifest") + Get-Content "src\EventLogExpert\Platforms\Windows\Package.appxmanifest" + displayName: 'set version in manifest' + - pwsh: > + dotnet publish src/EventLogExpert.EventDbTool/EventLogExpert.EventDbTool.csproj ` --self-contained ` -c Release ` -o "$(build.artifactStagingDirectory)" ` -p:IncludeNativeLibrariesForSelfExtract=true ` -p:PublishSingleFile=true ` -p:Version=$(ReleaseVersion) + displayName: 'dotnet publish EventDbTool' + - pwsh: > + dotnet publish src/EventLogExpert/EventLogExpert.csproj ` -c Release ` -f net8.0-windows10.0.19041.0 ` -p:AppxBundle=Never ` -p:AppInstallerCheckForUpdateFrequency=OnApplicationRun ` -p:AppInstallerUpdateFrequency=1 ` -p:AppInstallerUri="https://github.com/microsoft/EventLogExpert/releases/latest/download/" ` -p:GenerateAppInstallerFile=true ` -p:OutputPath="$(build.artifactStagingDirectory)\AppInstaller\" ` -p:RuntimeIdentifierOverride=win10-x64 ` -p:UapAppxPackageBuildMode=SideLoadOnly ` -p:Version=$(ReleaseVersion) + displayName: 'dotnet publish EventLogExpert' + - pwsh: | + Get-ChildItem -Recurse "$(build.artifactStagingDirectory)" + displayName: 'show all files' + - pwsh: | + Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\*.appinstaller" | % { Move-Item $_ "$(build.artifactStagingDirectory)" } + $msixFolder = Get-ChildItem "$(build.artifactStagingDirectory)\AppInstaller\AppPackages\" -Directory + echo "msixFolder: $msixFolder" + Get-ChildItem $msixFolder *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" } + Get-ChildItem (Join-Path $msixFolder "\Dependencies\x64\") *.msix | % { Move-Item $_ "$(build.artifactStagingDirectory)" } + displayName: 'move msix to staging directory' + - pwsh: | + Get-ChildItem "$(build.artifactStagingDirectory)" + displayName: 'show staging directory' + - pwsh: | + $appInstallerFile = Get-Item "$(build.artifactStagingDirectory)\*.appinstaller" + [xml]$appinstaller = Get-Content -Raw $appInstallerFile + $appInstaller.AppInstaller.MainPackage.Uri = $appInstaller.AppInstaller.MainPackage.Uri -replace "/download/(.*)/", "/download/" + $appInstaller.AppInstaller.Dependencies.Package.Uri = $appInstaller.AppInstaller.Dependencies.Package.Uri -replace "/download/(.*)/", "/download/" + $appInstaller.Save($appInstallerFile) + Get-Content $appInstallerFile + displayName: 'update appinstaller paths' + - task: EsrpCodeSigning@2 + inputs: + ConnectedServiceName: 'ESRP CodeSign for EventLogExpert' + FolderPath: "$(build.artifactStagingDirectory)" + Pattern: 'EventLogExpert_*.msix,eventdbtool.exe' + signConfigType: 'inlineSignParams' + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "EventLogExpert" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "https://github.com/microsoft/EventLogExpert" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd sha256" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "signtool.exe", + "toolVersion": "6.2.9304.0" + } + ] + SessionTimeout: '60' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + - pwsh: | + Get-ChildItem "$(build.artifactStagingDirectory)\*.exe" | % { Compress-Archive $_ "$(build.artifactStagingDirectory)\$([IO.Path]::GetFilenameWithoutExtension($_.Name)).zip" } + displayName: zip eventdbtool.exe + - task: GitHubRelease@1 + displayName: 'Create GitHub Release - Draft' + inputs: + gitHubConnection: 'github.com_eventlogexpert' + repositoryName: microsoft/EventLogExpert + action: create + tagSource: userSpecifiedTag + tagPattern: 'v$(ReleaseVersion)' + tag: v$(ReleaseVersion) + title: v$(ReleaseVersion) + assets: | + $(build.artifactStagingDirectory)\*.appinstaller + $(build.artifactStagingDirectory)\*.msix + $(build.artifactStagingDirectory)\*.zip + addChangeLog: true + isDraft: true \ No newline at end of file