From fb7b5fe378a78c2e63cc6291c7ae22fb53fee444 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 28 Sep 2022 22:13:59 -0700 Subject: [PATCH 01/10] Add publish symbols stage --- tools/releaseBuild/yaml/releaseBuild.yml | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index 2e71b3f..69b118f 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -8,6 +8,7 @@ variables: - name: PackageRoot value: '$(System.ArtifactsDirectory)/Packages' - group: PSNativeAPIScan + - group: SymbolPublish resources: repositories: @@ -105,6 +106,55 @@ stages: steps: - template: nuget.yml +- stage: PublishSymbol + displayName: Publish pwrshplugin symbols + dependsOn: Build + jobs: + - job: Symbols_Job + pool: + name: PowerShell1ES + demands: + - ImageOverride -equals PSMMS2019-PS-Native-Secure + steps: + - download: current + artifact: release + patterns: 'x*.zip' + + - pwsh: | + Write-Verbose -Verbose "Enumerating "$(Pipeline.Workspace)/release" + $downloadedArtifacts = Get-ChildItem -Recurse "$(Pipeline.Workspace)/release" + $downloadedArtifacts + + $expandedRoot = New-Item -Path "$(Pipeline.Workspace)/expanded" -ItemType Directory -Verbose + $symbolsRoot = New-Item -Path "$(Pipeline.Workspace)/symbols" -ItemType Directory -Verbose + + $downloadedArtifacts | Where-Object { $_.Extension -eq 'zip' } | ForEach-Object { + $destFolder = New-Item -Path "$expandedRoot/$($_.BaseName)/" -ItemType Directory -Verbose + Expand-Archive -Path $_.FullName -DestinationPath $destFolder -Force + + Get-ChildItem -Path $destFolder -Recurse -Filter *.pdb | ForEach-Object { + $runtimeFolder = New-Item -Path "$symbolsRoot/$($_.BaseName)/" -ItemType Directory -Verbose + Copy-Item -Path $_.FullName -Destination $runtimeFolder -Verbose + } + } + + Write-Verbose -Verbose "Enumerating "$symbolsRoot" + Get-ChildItem -Path $symbolsRoot -Recurse + + $vstsCommandString = "vso[task.setvariable variable=SymbolsPath]$symbolsRoot" + Write-Verbose -Message "$vstsCommandString" -Verbose + Write-Host -Object "##$vstsCommandString" + displayName: Expand and capture symbols folders + + - task: PublishSymbols@2 + inputs: + symbolsFolder: '$(SymbolsPath)' + searchPattern: '**/*.pdb' + indexSources: false + publishSymbols: true + symbolServerType: teamServices + detailedLog: true + - stage: compliance displayName: Compliance dependsOn: Build From 8edb3a561e2ac98a39a5db1dedf86c409019ed4b Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 00:35:50 -0700 Subject: [PATCH 02/10] Fix subscription variableS --- tools/releaseBuild/yaml/releaseBuild.yml | 1 + tools/releaseBuild/yaml/upload.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index 69b118f..d99e35b 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -9,6 +9,7 @@ variables: value: '$(System.ArtifactsDirectory)/Packages' - group: PSNativeAPIScan - group: SymbolPublish + - group: Azure Blob variable group resources: repositories: diff --git a/tools/releaseBuild/yaml/upload.yml b/tools/releaseBuild/yaml/upload.yml index 62ac0fb..b970290 100644 --- a/tools/releaseBuild/yaml/upload.yml +++ b/tools/releaseBuild/yaml/upload.yml @@ -7,8 +7,8 @@ steps: displayName: 'Upload ${{ parameters.fileName }} to azure blob' inputs: SourcePath: '${{ parameters.sourcePath }}' - azureSubscription: 'MGMT-Powershell-CICDInfra (94cf12ad-4fe9-490b-b281-0a260198a4e0)' + azureSubscription: '$(AzureFileCopySubscription)' Destination: AzureBlob - storage: pscoretestdata + storage: '$(StorageAccount)' ContainerName: 'PowerShell-Native-Symbols' BlobPrefix: '$(Build.SourceBranchName)' From e7c418f8ce786194cad04db19f3d131038dff932 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 10:09:55 -0700 Subject: [PATCH 03/10] Uninstall AzureRM --- tools/releaseBuild/yaml/upload.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/releaseBuild/yaml/upload.yml b/tools/releaseBuild/yaml/upload.yml index b970290..56f4526 100644 --- a/tools/releaseBuild/yaml/upload.yml +++ b/tools/releaseBuild/yaml/upload.yml @@ -3,6 +3,28 @@ parameters: sourcePath: '' steps: + +- powershell: | + $modules = 'Az.Accounts', 'Az.Storage' + foreach($module in $modules) { + if(!(get-module $module -listavailable)) { + Write-Verbose "installing $module..." -verbose + Install-Module $module -force -AllowClobber + } else { + #Write-Verbose "updating $module..." -verbose + #Update-Module $module -verbose + } + } + displayName: Install PowerShell modules + +- powershell: | + $azureRMModule = Get-Module -Name AzureRM -ListAvailable -ErrorAction SilentlyContinue + if ($azureRMModule) { + Uninstall-AzureRm + } + displayName: Uninstall Uninstall-AzureRm + continueOnError: true + - task: AzureFileCopy@4 displayName: 'Upload ${{ parameters.fileName }} to azure blob' inputs: From 933b580a263112ef8417e7c4ee4cebeb60f4b5a0 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 10:10:54 -0700 Subject: [PATCH 04/10] Fix yaml indent --- tools/releaseBuild/yaml/upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/yaml/upload.yml b/tools/releaseBuild/yaml/upload.yml index 56f4526..917e726 100644 --- a/tools/releaseBuild/yaml/upload.yml +++ b/tools/releaseBuild/yaml/upload.yml @@ -15,7 +15,7 @@ steps: #Update-Module $module -verbose } } - displayName: Install PowerShell modules + displayName: Install PowerShell modules - powershell: | $azureRMModule = Get-Module -Name AzureRM -ListAvailable -ErrorAction SilentlyContinue From 20f17bf0709b6b98b5946bea17785c4ddbb1841b Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 11:11:21 -0700 Subject: [PATCH 05/10] Update PowerShellGet --- tools/releaseBuild/yaml/upload.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/releaseBuild/yaml/upload.yml b/tools/releaseBuild/yaml/upload.yml index 917e726..27cfc53 100644 --- a/tools/releaseBuild/yaml/upload.yml +++ b/tools/releaseBuild/yaml/upload.yml @@ -4,6 +4,10 @@ parameters: steps: +- powershell: | + Install-Module PowerShellGet -RequiredVersion 2.2.5 -SkipPublisherCheck + displayName: Update PowerShell Get + - powershell: | $modules = 'Az.Accounts', 'Az.Storage' foreach($module in $modules) { From dd80fcc9f9d56b02315ac3ce99bfbdf3385efe18 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 14:15:35 -0700 Subject: [PATCH 06/10] Add package management bootstrap --- tools/releaseBuild/yaml/upload.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/releaseBuild/yaml/upload.yml b/tools/releaseBuild/yaml/upload.yml index 27cfc53..f288365 100644 --- a/tools/releaseBuild/yaml/upload.yml +++ b/tools/releaseBuild/yaml/upload.yml @@ -5,7 +5,13 @@ parameters: steps: - powershell: | - Install-Module PowerShellGet -RequiredVersion 2.2.5 -SkipPublisherCheck + [System.Net.ServicePointManager]::SecurityProtocol = + [System.Net.ServicePointManager]::SecurityProtocol -bor + [System.Security.Authentication.SslProtocols]::Tls12 -bor + [System.Security.Authentication.SslProtocols]::Tls11 + + Get-PackageProvider -Name NuGet -ForceBootstrap + Install-Module PowerShellGet -RequiredVersion 2.2.5 -SkipPublisherCheck -Force displayName: Update PowerShell Get - powershell: | From 3fa56795f1ad5deb34ff98250a024203682c457d Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 16:49:06 -0700 Subject: [PATCH 07/10] Add Az.Resources module --- tools/releaseBuild/yaml/upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/yaml/upload.yml b/tools/releaseBuild/yaml/upload.yml index f288365..af7100a 100644 --- a/tools/releaseBuild/yaml/upload.yml +++ b/tools/releaseBuild/yaml/upload.yml @@ -15,7 +15,7 @@ steps: displayName: Update PowerShell Get - powershell: | - $modules = 'Az.Accounts', 'Az.Storage' + $modules = 'Az.Accounts', 'Az.Storage', 'Az.Resources' foreach($module in $modules) { if(!(get-module $module -listavailable)) { Write-Verbose "installing $module..." -verbose From ede58dda6b288950f352abb5c2d4f0667bc95328 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 17:49:33 -0700 Subject: [PATCH 08/10] Fix filtering --- tools/releaseBuild/yaml/releaseBuild.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index d99e35b..81c0994 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -119,7 +119,6 @@ stages: steps: - download: current artifact: release - patterns: 'x*.zip' - pwsh: | Write-Verbose -Verbose "Enumerating "$(Pipeline.Workspace)/release" @@ -129,7 +128,7 @@ stages: $expandedRoot = New-Item -Path "$(Pipeline.Workspace)/expanded" -ItemType Directory -Verbose $symbolsRoot = New-Item -Path "$(Pipeline.Workspace)/symbols" -ItemType Directory -Verbose - $downloadedArtifacts | Where-Object { $_.Extension -eq 'zip' } | ForEach-Object { + $downloadedArtifacts | Where-Object { $_.Name -like 'x*-symbols.zip'} | ForEach-Object { $destFolder = New-Item -Path "$expandedRoot/$($_.BaseName)/" -ItemType Directory -Verbose Expand-Archive -Path $_.FullName -DestinationPath $destFolder -Force @@ -139,7 +138,7 @@ stages: } } - Write-Verbose -Verbose "Enumerating "$symbolsRoot" + Write-Verbose -Verbose "Enumerating $symbolsRoot" Get-ChildItem -Path $symbolsRoot -Recurse $vstsCommandString = "vso[task.setvariable variable=SymbolsPath]$symbolsRoot" From c6b25a31251014b5b0de221ac1a064d3868726f6 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 19:56:57 -0700 Subject: [PATCH 09/10] Fix quotes --- tools/releaseBuild/yaml/releaseBuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index 81c0994..02465c2 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -121,7 +121,7 @@ stages: artifact: release - pwsh: | - Write-Verbose -Verbose "Enumerating "$(Pipeline.Workspace)/release" + Write-Verbose -Verbose "Enumerating $(Pipeline.Workspace)/release" $downloadedArtifacts = Get-ChildItem -Recurse "$(Pipeline.Workspace)/release" $downloadedArtifacts @@ -132,7 +132,7 @@ stages: $destFolder = New-Item -Path "$expandedRoot/$($_.BaseName)/" -ItemType Directory -Verbose Expand-Archive -Path $_.FullName -DestinationPath $destFolder -Force - Get-ChildItem -Path $destFolder -Recurse -Filter *.pdb | ForEach-Object { + Get-ChildItem -Path $destFolder -Recurse -Filter '*.pdb' | ForEach-Object { $runtimeFolder = New-Item -Path "$symbolsRoot/$($_.BaseName)/" -ItemType Directory -Verbose Copy-Item -Path $_.FullName -Destination $runtimeFolder -Verbose } From d676aa04fb690ed0307301f3ad070442d742db61 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 29 Sep 2022 21:40:23 -0700 Subject: [PATCH 10/10] Fix runtime folder --- tools/releaseBuild/yaml/releaseBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index 02465c2..ae405ae 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -133,7 +133,7 @@ stages: Expand-Archive -Path $_.FullName -DestinationPath $destFolder -Force Get-ChildItem -Path $destFolder -Recurse -Filter '*.pdb' | ForEach-Object { - $runtimeFolder = New-Item -Path "$symbolsRoot/$($_.BaseName)/" -ItemType Directory -Verbose + $runtimeFolder = New-Item -Path "$symbolsRoot/$($destFolder.BaseName)/" -ItemType Directory -Verbose Copy-Item -Path $_.FullName -Destination $runtimeFolder -Verbose } }