diff --git a/tools/releaseBuild/yaml/releaseBuild.yml b/tools/releaseBuild/yaml/releaseBuild.yml index 2e71b3f..ae405ae 100644 --- a/tools/releaseBuild/yaml/releaseBuild.yml +++ b/tools/releaseBuild/yaml/releaseBuild.yml @@ -8,6 +8,8 @@ variables: - name: PackageRoot value: '$(System.ArtifactsDirectory)/Packages' - group: PSNativeAPIScan + - group: SymbolPublish + - group: Azure Blob variable group resources: repositories: @@ -105,6 +107,54 @@ 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 + + - 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 { $_.Name -like 'x*-symbols.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/$($destFolder.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 diff --git a/tools/releaseBuild/yaml/upload.yml b/tools/releaseBuild/yaml/upload.yml index 62ac0fb..af7100a 100644 --- a/tools/releaseBuild/yaml/upload.yml +++ b/tools/releaseBuild/yaml/upload.yml @@ -3,12 +3,44 @@ parameters: sourcePath: '' steps: + +- powershell: | + [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: | + $modules = 'Az.Accounts', 'Az.Storage', 'Az.Resources' + 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: 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)'