From cb9665594175b6b2d8e3559842f3e6c3c76c643d Mon Sep 17 00:00:00 2001 From: Bill Long Date: Thu, 27 Jun 2024 14:13:54 -0500 Subject: [PATCH] Update pipelines to use 1ES templates --- .../IIS/ExchangeBackEnd-ECP_web.config | 52 ++-- azure-pipeline-merge.yml | 87 ++++--- azure-pipeline-release.yml | 223 +++++++++--------- 3 files changed, 191 insertions(+), 171 deletions(-) diff --git a/Diagnostics/HealthChecker/Tests/DataCollection/E15/Exchange/IIS/ExchangeBackEnd-ECP_web.config b/Diagnostics/HealthChecker/Tests/DataCollection/E15/Exchange/IIS/ExchangeBackEnd-ECP_web.config index 674e3ca42a..adcc65db73 100644 --- a/Diagnostics/HealthChecker/Tests/DataCollection/E15/Exchange/IIS/ExchangeBackEnd-ECP_web.config +++ b/Diagnostics/HealthChecker/Tests/DataCollection/E15/Exchange/IIS/ExchangeBackEnd-ECP_web.config @@ -1,31 +1,31 @@  - - - @@ -337,7 +337,7 @@ - diff --git a/azure-pipeline-merge.yml b/azure-pipeline-merge.yml index be7009b9ee..ad846fe10c 100644 --- a/azure-pipeline-merge.yml +++ b/azure-pipeline-merge.yml @@ -1,38 +1,49 @@ -pool: - vmImage: 'windows-latest' - -steps: -- pwsh: | - cd .\.build - .\docs.ps1 - displayName: "Docs Check" - -- pwsh: .\.build\SpellCheck.ps1 - displayName: "Spell Check" - -- pwsh: | - cd .\.build - .\CodeFormatter.ps1 -Branch $env:TargetBranchName - displayName: "Code Formatting Script" - condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/release')) - env: - TargetBranchName: $(System.PullRequest.TargetBranch) - -- pwsh: | - cd .\.build - .\Build.ps1 - displayName: "Build Script" - -- pwsh: | - cd .\.build - .\Pester.ps1 -NoProgress -Branch $env:TargetBranchName - displayName: "Running Invoke-Pester" - env: - TargetBranchName: $(System.PullRequest.TargetBranch) - -- pwsh: | - cd .\.build - .\ValidateMerge.ps1 -Branch $env:TargetBranchName - displayName: "Validate commit times" - env: - TargetBranchName: $(System.PullRequest.TargetBranch) +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: + - pwsh: | + cd .\.build + .\docs.ps1 + displayName: "Docs Check" + - pwsh: .\.build\SpellCheck.ps1 + displayName: "Spell Check" + - pwsh: | + cd .\.build + .\CodeFormatter.ps1 -Branch $env:TargetBranchName + displayName: "Code Formatting Script" + condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/release')) + env: + TargetBranchName: $(System.PullRequest.TargetBranch) + - pwsh: | + cd .\.build + .\Build.ps1 + displayName: "Build Script" + - pwsh: | + cd .\.build + .\Pester.ps1 -NoProgress -Branch $env:TargetBranchName + displayName: "Running Invoke-Pester" + env: + TargetBranchName: $(System.PullRequest.TargetBranch) + - pwsh: | + cd .\.build + .\ValidateMerge.ps1 -Branch $env:TargetBranchName + displayName: "Validate commit times" + env: + TargetBranchName: $(System.PullRequest.TargetBranch) diff --git a/azure-pipeline-release.yml b/azure-pipeline-release.yml index e0f4c55589..ce768e4c2e 100644 --- a/azure-pipeline-release.yml +++ b/azure-pipeline-release.yml @@ -1,110 +1,119 @@ trigger: branches: include: - - release - -pool: - vmImage: 'windows-latest' - -steps: -- pwsh: | - cd .\.build - .\Build.ps1 - displayName: "Build Script" - -- task: EsrpCodeSigning@2 - condition: and(succeeded(), ne (variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/release')) - inputs: - ConnectedServiceName: 'CSS Exchange Code Sign' - FolderPath: 'dist' - Pattern: '*.ps1' - signConfigType: 'inlineSignParams' - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ - { - "parameterName": "OpusName", - "parameterValue": "CSS Exchange" - }, - { - "parameterName": "OpusInfo", - "parameterValue": "https://github.com/microsoft/CSS-Exchange" - }, - { - "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: | - cd .\.build - .\BuildScriptVersions.ps1 - displayName: "Build ScriptVersions.txt" - -- pwsh: | - Get-Content dist\ScriptVersions.txt - displayName: "Display Script Versions file" - -- pwsh: | - $tag = "v$((Get-Date).ToString(`"yy.MM.dd.HHmm`"))" - Write-Host "##vso[task.setvariable variable=ReleaseTagValue]$tag" - (Get-Content .\dist\ScriptVersions.txt) -replace '^(\S+.ps1)', ('[$1](https://github.com/microsoft/CSS-Exchange/releases/download/' + $tag + '/$1)') | Out-File dist\ScriptVersions.txt - Get-Content dist\ScriptVersions.txt - displayName: "Setting Script Versions text file" - -- task: GitHubRelease@0 - displayName: 'Create GitHub Release - Draft' - condition: and(succeeded(), ne (variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/release')) - inputs: - gitHubConnection: 'GitHub Release' - repositoryName: microsoft/CSS-Exchange - action: create - tagSource: manual - tagPattern: 'v[0-9].[0-9].[0-9].[0-9]' - tag: $(ReleaseTagValue) - title: $(ReleaseTagValue) - releaseNotesSource: 'file' - releaseNotesFile: dist\ScriptVersions.txt - assets: | - dist\*.ps1 - dist\*.nse - dist\*.zip - dist\*.txt - dist\*.csv - addChangeLog: true - isDraft: true - -- task: GitHubRelease@0 - displayName: 'Publish GitHub Release' - condition: and(succeeded(), ne (variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/release')) - inputs: - gitHubConnection: 'GitHub Release' - repositoryName: microsoft/CSS-Exchange - action: edit - tagSource: manual - tagPattern: 'v[0-9].[0-9].[0-9].[0-9]' - tag: $(ReleaseTagValue) - title: $(ReleaseTagValue) - releaseNotesSource: 'file' - releaseNotesFile: dist\ScriptVersions.txt - assetUploadMode: replace - addChangeLog: true - isDraft: false + - release +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: + - pwsh: | + cd .\.build + .\Build.ps1 + displayName: "Build Script" + - task: EsrpCodeSigning@2 + condition: and(succeeded(), ne (variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/release')) + inputs: + ConnectedServiceName: 'CSS Exchange Code Sign' + FolderPath: 'dist' + Pattern: '*.ps1' + signConfigType: 'inlineSignParams' + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "CSS Exchange" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "https://github.com/microsoft/CSS-Exchange" + }, + { + "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: | + cd .\.build + .\BuildScriptVersions.ps1 + displayName: "Build ScriptVersions.txt" + - pwsh: | + Get-Content dist\ScriptVersions.txt + displayName: "Display Script Versions file" + - pwsh: | + $tag = "v$((Get-Date).ToString(`"yy.MM.dd.HHmm`"))" + Write-Host "##vso[task.setvariable variable=ReleaseTagValue]$tag" + (Get-Content .\dist\ScriptVersions.txt) -replace '^(\S+.ps1)', ('[$1](https://github.com/microsoft/CSS-Exchange/releases/download/' + $tag + '/$1)') | Out-File dist\ScriptVersions.txt + Get-Content dist\ScriptVersions.txt + displayName: "Setting Script Versions text file" + - task: GitHubRelease@0 + displayName: 'Create GitHub Release - Draft' + condition: and(succeeded(), ne (variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/release')) + inputs: + gitHubConnection: 'GitHub Release' + repositoryName: microsoft/CSS-Exchange + action: create + tagSource: manual + tagPattern: 'v[0-9].[0-9].[0-9].[0-9]' + tag: $(ReleaseTagValue) + title: $(ReleaseTagValue) + releaseNotesSource: 'file' + releaseNotesFile: dist\ScriptVersions.txt + assets: | + dist\*.ps1 + dist\*.nse + dist\*.zip + dist\*.txt + dist\*.csv + addChangeLog: true + isDraft: true + - task: GitHubRelease@0 + displayName: 'Publish GitHub Release' + condition: and(succeeded(), ne (variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/release')) + inputs: + gitHubConnection: 'GitHub Release' + repositoryName: microsoft/CSS-Exchange + action: edit + tagSource: manual + tagPattern: 'v[0-9].[0-9].[0-9].[0-9]' + tag: $(ReleaseTagValue) + title: $(ReleaseTagValue) + releaseNotesSource: 'file' + releaseNotesFile: dist\ScriptVersions.txt + assetUploadMode: replace + addChangeLog: true + isDraft: false