From eb3add86ec31deb30cd636f41dc7f2842c9b8b61 Mon Sep 17 00:00:00 2001 From: kyelamarthi1 <93476839+kyelamarthi1@users.noreply.github.com> Date: Fri, 24 Nov 2023 14:16:41 +0530 Subject: [PATCH] Converted 1ES pipelines (#606) --- .../microsoft-xPlatAppx-36972-converted.yml | 168 ++++++++ ...xPlatAppx-release-msixmgr-v1-converted.yml | 400 ++++++++++++++++++ 2 files changed, 568 insertions(+) create mode 100644 pipelines/microsoft-xPlatAppx-36972-converted.yml create mode 100644 pipelines/templates/task-group-microsoft-xPlatAppx-release-msixmgr-v1-converted.yml diff --git a/pipelines/microsoft-xPlatAppx-36972-converted.yml b/pipelines/microsoft-xPlatAppx-36972-converted.yml new file mode 100644 index 00000000..da4cb771 --- /dev/null +++ b/pipelines/microsoft-xPlatAppx-36972-converted.yml @@ -0,0 +1,168 @@ +# This pipeline was generated from the classic pipeline "CIGitHub-for-MsixCoreInstaller" on 2023-11-17 with https://aka.ms/1ESPTMigration (v1.0.0): https://dev.azure.com/microsoft/xPlatAppx/_build?definitionId=36972 +# +# The following items require attention: +# Variables were exported from the classic pipeline, confirm that `variables` values do not contain private information. If a variable contains private information, follow the guidance on handling secret variables: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-secret-variables +# Secret variable 'TDBuildAuthenticationAADSecret' detected in `variables`, follow the guidance on handling secret variables: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-secret-variables +# 'Allow scripts to access the OAuth token' was selected in pipeline. Add the following YAML to any steps requiring access: +# env: +# MY_ACCESS_TOKEN: $(System.AccessToken) +# The task group "Release msixmgr" was converted to a template: task-group-microsoft-xPlatAppx-release-msixmgr-v1-converted.yml with 1 change(s): +# - The task PublishBuildArtifacts@1 ("Publish Artifact: drop") was removed and replaced as `job.templateContext.outputs` in this file +# The following task is disabled in "Run Tests" and not included in the converted pipeline: "Download Pipeline Artifact" + +name: $(TeamProject)_$(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) +variables: + - name: AndroidChkBuilds + value: "" + - name: system.debug + value: false + - name: TDBuildAuthenticationAADSecret + value: null +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +trigger: + branches: + include: + - master +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + pool: + os: windows + image: windows-2019 + name: Azure Pipelines + customBuildTags: + - MigrationTooling-microsoft-xPlatAppx-36972-Tool + stages: + - stage: Stage + jobs: + - job: Phase_15 + displayName: Build and Release MsixMgr + cancelTimeoutInMinutes: 1 + env: + MY_ACCESS_TOKEN: $(System.AccessToken) + templateContext: + outputs: + - output: pipelineArtifact + artifactName: drop + targetPath: $(Build.ArtifactStagingDirectory) + displayName: "Publish Artifact: drop" + steps: + - checkout: self + clean: true + submodules: true + lfs: true + fetchTags: false + persistCredentials: true + - template: task-group-microsoft-xPlatAppx-release-msixmgr-v1-converted.yml@self + parameters: + MSBuildArgs: /t:msixmgr + MSBuildArgs2: /t:GetMsixmgrProducts;MsixMgrWix /p:RunWixToolsOutOfProc=true /p:PostBuildEventUseInBuild=false + TDBuildAuthenticationAADSecret: $(TDBuildAuthenticationAADSecret) + - job: Job_1 + displayName: Run Tests + dependsOn: Phase_15 + templateContext: + outputs: + - output: pipelineArtifact + artifactName: droplogs + targetPath: $(Build.ArtifactStagingDirectory) + displayName: "Publish Artifact: droplogs" + condition: succeededOrFailed() + steps: + - checkout: self + clean: true + submodules: true + lfs: true + fetchTags: false + - task: DownloadBuildArtifacts@0 + displayName: Download Build Artifacts + inputs: + downloadType: specific + downloadPath: $(Pipeline.Workspace) + extractTars: false + - task: PowerShell@2 + displayName: Find and install msixmgrSetup + inputs: + targetType: inline + script: | + # Write your PowerShell commands here. + + $installtarget = dir -recurse $env:ArtifactDirectory\msixmgrSetup-*-x64.msi + + $installtarget + + start-process -wait -filepath msiexec -argumentlist /I, $installtarget.fullname, /qn + + git lfs fetch + git lfs pull + env: + ArtifactDirectory: $(Pipeline.Workspace) + - task: PowerShell@2 + displayName: Run msixcore tests + inputs: + filePath: MsixCore/Tests/test.ps1 + arguments: -binary $env:ProgramFiles\msixmgr -taketrace $true + errorActionPreference: continue + workingDirectory: MsixCore/Tests + continueOnError: true + - task: PowerShell@2 + displayName: Debugging on agent machine commands + condition: succeededOrFailed() + inputs: + targetType: inline + script: |- + #write-host "environment-variables" + #dir env: + + #write-host "msixmgr directory" + #dir $env:ProgramFiles\msixmgr + + #write-host "current directory" + #convert-path . + cd msixcore\tests + convert-path . + + $executable = join-path $env:ProgramFiles "msixmgr\msixmgr.exe" + + & .\msixtrace.ps1 -start + + write-host "all packages" + & $executable -FindPackage * + + write-host "fake does not exist package" + & $executable -FindPackage fakedoesnotexist_1.0.0.1_x64__8wekyb3d8bbwe + + write-host "add notepad" + & $executable -AddPackage notepadplus.msix -quietUx + + write-host "all packages" + & $executable -FindPackage * + + write-host "fake does not exist package" + & $executable -FindPackage fakedoesnotexist_1.0.0.1_x64__8wekyb3d8bbwe + + write-host "remove notepad" + & $executable -RemovePackage notepadplus_0.0.0.0_x64__8wekyb3d8bbwe + + write-host "all packages" + & $executable -FindPackage * + + write-host "fake does not exist package" + & $executable -FindPackage fakedoesnotexist_1.0.0.1_x64__8wekyb3d8bbwe + + & .\msixtrace.ps1 -stop + errorActionPreference: silentlyContinue + ignoreLASTEXITCODE: true + continueOnError: true + - task: CopyFiles@2 + displayName: "Copy Files to: $(Build.ArtifactStagingDirectory)" + condition: succeededOrFailed() + inputs: + SourceFolder: MsixCore/Tests + Contents: msixtrace*.log + TargetFolder: $(Build.ArtifactStagingDirectory) diff --git a/pipelines/templates/task-group-microsoft-xPlatAppx-release-msixmgr-v1-converted.yml b/pipelines/templates/task-group-microsoft-xPlatAppx-release-msixmgr-v1-converted.yml new file mode 100644 index 00000000..c22dd09e --- /dev/null +++ b/pipelines/templates/task-group-microsoft-xPlatAppx-release-msixmgr-v1-converted.yml @@ -0,0 +1,400 @@ +# This template was generated from the task group "Release msixmgr" on 2023-11-17 with https://aka.ms/1ESPTMigration (v1.0.0): https://dev.azure.com/microsoft/xPlatAppx/_taskgroup/0d4960a2-f706-4dcf-bcdc-7dad94d125d7 +# Description: Build msix +# Build msixmgr + msixmgrSetup +# Publish +# release MSI to Github +# +# The following items require attention: +# The pipeline uses service connection "ESRP CodeSignin connection 3", you will need to grant the new pipeline access: https://dev.azure.com/microsoft/xPlatAppx/_settings/adminservices?resourceId=0b701fca-7198-4a11-aee4-84090fc83e58 +# The pipeline uses service connection "github.com_wcheng-msft", you will need to grant the new pipeline access: https://dev.azure.com/microsoft/xPlatAppx/_settings/adminservices?resourceId=26b61696-c93f-42f3-af20-4a0f32ec8336 +# The following tasks are disabled and not included in the converted pipeline: "GitHub release (delete) 1-time for deleting on name changes. Enable when needed.", "GitHub release (create official release) enable when necessary" +# The task PublishBuildArtifacts@1 ("Publish Artifact: drop") was removed from this file and replaced as `job.templateContext.outputs` in the parent yaml: https://aka.ms/1esptoutputs + +parameters: + - name: MSBuildArgs + type: string + - name: MSBuildArgs2 + type: string + - name: TDBuildAuthenticationAADSecret + type: string +steps: + - task: PowerShell@2 + displayName: Update version number in msixmgr.rc + inputs: + targetType: inline + script: |- + # Use the environment variables input below to pass secret variables to this script. + $rcFile = join-path (convert-path .) "MsixCore\msixmgr\msixmgr.rc" + $gitDescribe = git describe --match MSIX*release --tags --long + $parts = $gitDescribe.split('-') + + #expected format is gittag-commitsSinceTag-commitID + #our git describe command searches only for msixmgr tags, we expect the format of the msixmgr tags to be msixmgr- + if ($parts.length -ge 4) + { + $version = "1.0" + for ($i = 0; $i -lt $parts.length - 2; $i++) + { + if (($parts[$i] -as [float]) -ne $null) + { + $version = $parts[$i] + } + } + + $commitsSinceTag = $parts[$parts.length-2] + + $version += ".$commitsSinceTag.0" + $version + + ####WHEN RELEASE, HARDCODE HERE + ### $version = "1.1.0.0" + $versionWithCommas = $version.replace('.', ',') + + #define VER_FILEVERSION 1,0,0,0 + $fileVersionLine = "#define VER_FILEVERSION $versionWithCommas" + #define VER_FILEVERSION_STR "1.0.0.0" + $fileVersionStrLine = "#define VER_FILEVERSION_STR `"$version`"" + + $rcContent = Get-Content $rcFile + $newContent = @() + foreach ($line in $rcContent) + { + if ($line.contains("#define VER_FILEVERSION ")) + { + $newContent += $fileVersionLine + } + elseif ($line.contains("#define VER_FILEVERSION_STR")) + { + $newContent += $fileVersionStrLine + } + else + { + $newContent += $line + } + } + + $newContent > $rcFile + } + + + # dir env: + errorActionPreference: silentlyContinue + continueOnError: true + - task: PowerShell@2 + displayName: Enable Telemetry Logging + inputs: + targetType: inline + script: |- + # Enabling the Telemetry Logging by setting the Provider Group + + $telemetry = Get-Content "MsixCore\msixmgr\msixmgrTelemetry.hpp" + $telemetry = $telemetry.replace("0000000000, 00000, 00000, 0000, 0000, 0000, 0000, 0000, 000, 0000, 0000", "0x4f50731a, 0x89cf, 0x4782, 0xb3, 0xe0, 0xdc, 0xe8, 0xc9, 0x4, 0x76, 0xba") + $telemetry | out-file -FilePath "MsixCore\msixmgr\msixmgrTelemetry.hpp" -Force + - task: BatchScript@1 + displayName: Run script makewin.cmd x64 + inputs: + filename: makewin.cmd + arguments: x64 -mt + - task: VSBuild@1 + displayName: Build solution MsixCore\msixmgr.sln x64 + inputs: + solution: MsixCore\msixmgr.sln + msbuildArgs: ${{parameters.MSBuildArgs}} + platform: x64 + configuration: Release + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: ESRP CodeSigning x64 binaries + inputs: + ConnectedServiceName: ESRP CodeSignin connection 3 + FolderPath: MsixCore + Pattern: msixmgr.exe,msix.dll,applyacls.dll + signConfigType: inlineSignParams + inlineOperation: |- + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + VerboseLogin: true + continueOnError: true + - task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1 + displayName: Touchdown Build - 5230, PRODEXT + inputs: + teamId: "5230" + authId: 79bf82f7-9575-4031-898d-c2ce600461d4 + authKey: ${{parameters.TDBuildAuthenticationAADSecret}} + isPreview: false + resourceFilePath: |- + MsixCore\x64\Release\msixmgr.exe.mui;O:MsixCore\msixmgr\loc + MsixCore\MsixMgrWix\en-us\strings.wxl;O:MsixCore\MsixMgrWix + gitAction: PULLREQUEST + - task: PowerShell@2 + displayName: fix up WXL and create PR for Loc changes + inputs: + targetType: inline + script: | + $gitdescribe = git describe + + dir MsixCore\MsixMgrWix |% { + $culture = $_.name + $filename = join-path $_.fullname "strings.wxl" + if (test-path $filename) { + $xml = [xml] (select-xml -path $filename -xpath /).node + $xml.WixLocalization.setattribute("Culture", $culture) + $xml.save($filename) + } + } + + $hasMuiChange = (git status MsixCore/msixmgr/loc |% {$_.contains("modified")}).contains($true) + $hasWxlChange = (git status MsixCore/MsixMgrWix |% {$_.contains("modified")}).contains($true) + If ($hasMuiChange -or $hasWxlChange) + { + git checkout -b localization-update-$gitdescribe-$env:build_buildid + git add MsixCore/msixmgr/loc + git add MsixCore/MsixMgrWix + git commit -m "localization changes from build" + + $path = $env:Path + write-host "updating Path = $env:Path to point to $env:programfiles\git\cmd first" + $env:path = "$env:programfiles\git\cmd;$env:path" + + & "$env:programfiles\githubcli\bin\hub.exe" pull-request -p --no-edit + + write-host "updating path back to original " + $env:path = $path + } + git status + + #dir -recurse MsixCore/msixmgr + errorActionPreference: continue + - task: VSBuild@1 + displayName: Build GetMsixmgrProductsCA and MsixMgrWix x64 + inputs: + solution: MsixCore\msixmgr.sln + msbuildArgs: ${{parameters.MSBuildArgs2}} + platform: x64 + configuration: Release + - task: BatchScript@1 + displayName: Run script makewin.cmd x86 + inputs: + filename: makewin.cmd + arguments: x86 -mt + - task: VSBuild@1 + displayName: Build solution MsixCore\msixmgr.sln x86 + inputs: + solution: MsixCore\msixmgr.sln + msbuildArgs: ${{parameters.MSBuildArgs}} + platform: x86 + configuration: Release + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: ESRP CodeSigning x86 binaries + inputs: + ConnectedServiceName: ESRP CodeSignin connection 3 + FolderPath: MsixCore + Pattern: msixmgr.exe,msix.dll,applyacls.dll + signConfigType: inlineSignParams + inlineOperation: |- + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + VerboseLogin: true + continueOnError: true + - task: VSBuild@1 + displayName: Build GetMsixmgrProductsCA and MsixMgrWix x86 + inputs: + solution: MsixCore\msixmgr.sln + msbuildArgs: ${{parameters.MSBuildArgs2}} + platform: x86 + configuration: Release + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: ESRP CodeSigning MSI packages + inputs: + ConnectedServiceName: ESRP CodeSignin connection 3 + FolderPath: MsixCore\MsixMgrWix\bin + Pattern: "*.msi" + signConfigType: inlineSignParams + inlineOperation: |- + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: "20" + continueOnError: true + - task: PowerShell@2 + displayName: Revert version number changes + condition: succeededOrFailed() + inputs: + targetType: inline + script: git checkout -- MsixCore/msixmgr/msixmgr.rc + errorActionPreference: silentlyContinue + continueOnError: true + - task: PowerShell@2 + displayName: create zip of files + inputs: + targetType: inline + script: | + + $zipdir = join-path (convert-path .) "MsixCore\x64\Release\zip" + $zipdir64 = join-path (convert-path .) "MsixCore\x64\Release\zip\x64" + $zipdir86 = join-path (convert-path .) "MsixCore\x64\Release\zip\x86" + $zipFile = join-path (convert-path .) "MsixCore\x64\Release\msixmgr.zip" + + md $zipdir64 -erroraction ignore + copy MsixCore\x64\Release\msixmgr.exe $zipdir64 + copy MsixCore\x64\Release\msix.dll $zipdir64 + copy MsixCore\Dependencies\x64\*.dll $zipdir64 + md $zipdir64\en-US -erroraction ignore + copy MsixCore\x64\Release\msixmgr.exe.mui $zipdir64\en-US + copy-item -recurse MsixCore\MsixMgr\loc\* $zipdir64 + + md $zipdir86 -erroraction ignore + copy MsixCore\x86\Release\msixmgr.exe $zipdir86 + copy MsixCore\x86\Release\msix.dll $zipdir86 + copy MsixCore\Dependencies\x86\*.dll $zipdir86 + md $zipdir86\en-US -erroraction ignore + copy MsixCore\x86\Release\msixmgr.exe.mui $zipdir86\en-US + copy-item -recurse MsixCore\MsixMgr\loc\* $zipdir86 + + #copy-item -recurse MsixCore\MsixMgrWix\loc $zipdir + + if (test-path $zipFile ) {del $zipFile } + add-type -assembly system.io.compression.filesystem + [System.IO.Compression.ZipFile]::CreateFromDirectory($zipdir, $zipfile) + errorActionPreference: silentlyContinue + continueOnError: true + - task: PowerShell@2 + displayName: Copy and rename files to artifact staging directory + inputs: + targetType: inline + script: |- + $TargetDir = $env:TargetDir + + copy MsixCore\x64\Release\msixmgr.zip $targetDir + + $version = (dir MsixCore\x64\Release\msixmgr.exe).versioninfo.fileversion + + copy MsixCore\MsixMgrWix\bin\x64\Release\msixmgrSetup.msi $targetDir\msixmgrSetup-$version-x64.msi + copy MsixCore\MsixMgrWix\bin\x86\Release\msixmgrSetup.msi $targetDir\msixmgrSetup-$version-x86.msi + copy MsixCore\Tests\msixtrace.ps1 $targetDir\msixtrace.ps1 + errorActionPreference: silentlyContinue + continueOnError: true + env: + TargetDir: $(Build.ArtifactStagingDirectory) + - task: GitHubRelease@0 + displayName: GitHub release (delete preview) + inputs: + gitHubConnection: github.com_wcheng-msft + action: delete + tag: MSIX-Core-preview + continueOnError: true + - task: GitHubRelease@0 + displayName: GitHub release (create preview) + inputs: + gitHubConnection: github.com_wcheng-msft + tagSource: manual + tag: MSIX-Core-preview + title: MSIX Core preview + releaseNotesSource: input + releaseNotes: This is MSIX Core preview build. This build contains the latest changes prior to official releases. + isPreRelease: true + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: Component Detection