Skip to content

Publish symbols to symbols server for pwrshplugin.dll #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions tools/releaseBuild/yaml/releaseBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ variables:
- name: PackageRoot
value: '$(System.ArtifactsDirectory)/Packages'
- group: PSNativeAPIScan
- group: SymbolPublish
- group: Azure Blob variable group

resources:
repositories:
Expand Down Expand Up @@ -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
Expand Down
36 changes: 34 additions & 2 deletions tools/releaseBuild/yaml/upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)'