From c05f1d18eab28a54a7bb01ef6edabc2758c68ad9 Mon Sep 17 00:00:00 2001 From: Jevan Saks Date: Tue, 19 Mar 2019 11:45:29 -0700 Subject: [PATCH] Change release pipeline to use hosted agents for build (#445) --- .../MUX-CreateNugetPackage-Job.yml | 2 +- build/MUX-CI.yml | 9 +- build/MUX-Release.yml | 87 ++++++++++++++----- build/SignConfig.xml | 10 ++- tools/PublishSymbols/PublishSymbols.cmd | 3 - tools/PublishSymbols/PublishSymbols.ps1 | 15 ++-- 6 files changed, 88 insertions(+), 38 deletions(-) delete mode 100644 tools/PublishSymbols/PublishSymbols.cmd diff --git a/build/AzurePipelinesTemplates/MUX-CreateNugetPackage-Job.yml b/build/AzurePipelinesTemplates/MUX-CreateNugetPackage-Job.yml index c6df5ebe27..7cdce76626 100644 --- a/build/AzurePipelinesTemplates/MUX-CreateNugetPackage-Job.yml +++ b/build/AzurePipelinesTemplates/MUX-CreateNugetPackage-Job.yml @@ -29,7 +29,7 @@ jobs: displayName: 'XESSetupBuild' inputs: productName: dep.controls - branchVersion: true + branchVersion: false nugetVer: true - template: MUX-PopulateBuildDateAndRevision-Steps.yml diff --git a/build/MUX-CI.yml b/build/MUX-CI.yml index 0a674d7530..e431e60c00 100644 --- a/build/MUX-CI.yml +++ b/build/MUX-CI.yml @@ -24,12 +24,9 @@ jobs: buildConfiguration: 'Release' variables: - - name: appxPackageDir - value: $(build.artifactStagingDirectory)\$(buildConfiguration)\$(buildPlatform)\AppxPackages - - name: buildOutputDir - value: $(Build.SourcesDirectory)\BuildOutput - - name: publishDir - value: $(Build.ArtifactStagingDirectory) + appxPackageDir : $(build.artifactStagingDirectory)\$(buildConfiguration)\$(buildPlatform)\AppxPackages + buildOutputDir : $(Build.SourcesDirectory)\BuildOutput + publishDir : $(Build.ArtifactStagingDirectory) steps: - template: AzurePipelinesTemplates\MUX-BuildDevProject-Steps.yml diff --git a/build/MUX-Release.yml b/build/MUX-Release.yml index 7ca25ad3ae..4b648ab4d3 100644 --- a/build/MUX-Release.yml +++ b/build/MUX-Release.yml @@ -9,10 +9,12 @@ jobs: displayName: 'Component Detection' - job: Build + # Skip the build job if we are reusing the output of a previous build. + # useBuildOutputFromBuildId variable is set on the Pipeline at Queue time. + condition: + eq(variables['useBuildOutputFromBuildId'],'') pool: - name: Package ES Custom Demands Lab A - demands: - - ClientAlias -equals depcontrols2 + vmImage: 'VS2017-Win2016' timeoutInMinutes: 120 strategy: maxParallel: 10 @@ -31,44 +33,87 @@ jobs: buildConfiguration: 'Release' variables: - - name: appxPackageDir - value: $(build.artifactStagingDirectory)\$(buildConfiguration)\$(buildPlatform)\AppxPackages - - name: buildOutputDir - value: $(Build.BinariesDirectory) - - name: publishDir - value: $(Build.ArtifactStagingDirectory) + appxPackageDir : $(build.artifactStagingDirectory)\$(buildConfiguration)\$(buildPlatform)\AppxPackages + buildOutputDir : $(Build.SourcesDirectory)\BuildOutput + publishDir : $(Build.ArtifactStagingDirectory) + + steps: + - template: AzurePipelinesTemplates\MUX-BuildDevProject-Steps.yml + + - template: AzurePipelinesTemplates\MUX-PublishDevProject-Steps.yml + +- job: SignBinariesAndPublishSymbols + dependsOn: Build + condition: + in(dependencies.Build.result, 'Succeeded', 'SucceededWithIssues', 'Skipped') + pool: + name: Package ES Custom Demands Lab A + demands: + - ClientAlias -equals depcontrols2 steps: - task: PkgESSetupBuild@10 displayName: 'XESSetupBuild' inputs: productName: dep.controls - branchVersion: true + branchVersion: false nugetVer: true - - template: AzurePipelinesTemplates\MUX-BuildDevProject-Steps.yml + - task: DownloadBuildArtifacts@0 + condition: + eq(variables['useBuildOutputFromBuildId'],'') + inputs: + artifactName: drop + downloadPath: '$(Build.ArtifactStagingDirectory)' + + - task: DownloadBuildArtifacts@0 + condition: + ne(variables['useBuildOutputFromBuildId'],'') + inputs: + buildType: specific + buildVersionToDownload: specific + project: 'f05f4dbf-3077-427d-91e0-b66d9e4ca374' + pipeline: 35915 + buildId: $(useBuildOutputFromBuildId) + artifactName: drop + downloadPath: '$(Build.ArtifactStagingDirectory)' + + - task: CmdLine@1 + displayName: 'Display build machine environment variables' + inputs: + filename: 'set' + + - script: cmd /c dir /s /b $(Build.ArtifactStagingDirectory) + displayName: Dump artifact staging directory + + - template: AzurePipelinesTemplates\MUX-PopulateBuildDateAndRevision-Steps.yml + + - task: powershell@2 + inputs: + targetType: filePath + filePath: $(Build.SourcesDirectory)\tools\PublishSymbols\PublishSymbols.ps1 + arguments: -localDirectory "$(Build.ArtifactStagingDirectory)\drop" -Verbose + displayName: 'Publish Symbols' - task: PkgESCodeSign@10 displayName: CodeSign inputs: signConfigXml: '$(Build.SourcesDirectory)\build\SignConfig.xml' - inPathRoot: '$(buildOutputDir)\$(buildConfiguration)\$(buildPlatform)' - outPathRoot: '$(buildOutputDir)\$(buildConfiguration)\$(buildPlatform)\signed' + inPathRoot: '$(Build.ArtifactStagingDirectory)\drop' + outPathRoot: '$(Build.ArtifactStagingDirectory)\drop' - - task: CmdLine@1 - displayName: 'Publish Symbol' + # Re-publish signed artifacts to the drop. + - task: PublishBuildArtifacts@1 + displayName: 'Publish artifact: drop' inputs: - filename: '$(Build.SourcesDirectory)\tools\PublishSymbols\PublishSymbols.cmd' - - - template: AzurePipelinesTemplates\MUX-PublishDevProject-Steps.yml + PathtoPublish: '$(Build.ArtifactStagingDirectory)\drop' + artifactName: 'drop' # Create Nuget Package - template: AzurePipelinesTemplates\MUX-CreateNugetPackage-Job.yml parameters: jobName: CreateNugetPackage - dependsOn: Build - # This is the magic GUID from the pipeline visual designer for this feed: https://dev.azure.com/ms/microsoft-ui-xaml/_packaging?_a=feed&feed=MUX-CI - # publishVstsFeed: 'd62f8eac-f05c-4c25-bccb-21f98b95c95f' + dependsOn: SignBinariesAndPublishSymbols signConfig: '$(Build.SourcesDirectory)\build\NuGetSignConfig.xml' # Build solution that depends on nuget package diff --git a/build/SignConfig.xml b/build/SignConfig.xml index 9a0a75e657..dadca50532 100644 --- a/build/SignConfig.xml +++ b/build/SignConfig.xml @@ -2,7 +2,13 @@ - - + + + + + + + + \ No newline at end of file diff --git a/tools/PublishSymbols/PublishSymbols.cmd b/tools/PublishSymbols/PublishSymbols.cmd deleted file mode 100644 index 5674f4e3d1..0000000000 --- a/tools/PublishSymbols/PublishSymbols.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off - -%~dp0\..\PowershellWrapper.cmd %~dpn0.ps1 %* \ No newline at end of file diff --git a/tools/PublishSymbols/PublishSymbols.ps1 b/tools/PublishSymbols/PublishSymbols.ps1 index f8084b3003..5425f4bd18 100644 --- a/tools/PublishSymbols/PublishSymbols.ps1 +++ b/tools/PublishSymbols/PublishSymbols.ps1 @@ -1,3 +1,9 @@ +[CmdLetBinding()] +Param( + [Parameter(Mandatory=$true, Position=0)] + [string]$localDirectory +) + Push-Location $PSScriptRoot [xml]$customProps = (Get-Content ..\..\custom.props) @@ -14,21 +20,20 @@ $buildVersion = $versionMajor + "." + $versionMinor + "." + $env:BUILD_BUILDNUMB Write-Host "Build = $buildVersion" -$buildId="$($env:BUILD_BUILDNUMBER)_$($env:BUILDCONFIGURATION)_$($env:BUILDPLATFORM)" -$localDirectory=$env:BUILD_BINARIESDIRECTORY + "\" + $env:BUILDCONFIGURATION + "\" + $env:BUILDPLATFORM + "\Microsoft.UI.Xaml" -$directory = "$env:XES_DFSDROP\$env:XES_RELATIVEOUTPUTROOT\Microsoft.UI.Xaml" +$buildId="$($env:BUILD_BUILDNUMBER)" +$directory = "$env:XES_DFSDROP" Write-Host "Local path: '$localDirectory'" Write-Host "Build share: '$directory'" -Copy-Item -Recurse "$localDirectory" "$directory" +Copy-Item -Recurse -Verbose "$localDirectory" "$directory" Write-Host "buildId = $buildId" Copy-Item pdb_index_template.ini pdb_index.ini Add-Content pdb_index.ini "Build=$buildVersion" -\\symbols\Tools\createrequest.cmd -i .\pdb_index.ini -d .\requests -c -a -b $buildId -e Release -g $directory +\\symbols\Tools\createrequest.cmd -i .\pdb_index.ini -d .\requests -c -a -b $buildId -e Release -g $directory -r if ($lastexitcode -ne 0) {