diff --git a/.ci/ci_release.yml b/.ci/ci_release.yml index a50e7e9f0..429bf7cf3 100644 --- a/.ci/ci_release.yml +++ b/.ci/ci_release.yml @@ -5,6 +5,7 @@ pr: none variables: - group: ESRP - group: GithubTestingFeedCreds + - group: PSGetSymbol # Prevents auto-injection of nuget-security-analysis (not needed for open source projects) - name: skipNugetSecurityAnalysis value: true @@ -235,6 +236,15 @@ stages: $vstsCommandString = "vso[task.setvariable variable=signOutPathCreated]${signOutPath}" Write-Host "sending " + $vstsCommandString Write-Host "##$vstsCommandString" + + # Upload symbol pdb file + $moduleName = "$($config.ModuleName)" + $symbolFilePath = Join-Path -Path $srcPath -ChildPath "$moduleName.pdb" + $folderName = "symbolResult" + $artifactName = "symbolfile" + $vstsCommandString = "vso[artifact.upload containerfolder=${folderName};artifactname=${artifactName}]${symbolFilePath}" + Write-Host "sending " + $vstsCommandString + Write-Host "##$vstsCommandString" displayName: Set up for module created files code signing condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), ne(variables['SkipSigning'], 'True')) @@ -407,6 +417,12 @@ stages: displayName: PowerShell Core on macOS imageName: macOS-latest +- stage: PublishSymbols + displayName: Publish Symbols + condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), eq(variables['Publish'], 'True')) + jobs: + - template: publishsymbols.yml + - stage: Release displayName: Publish Package to PSGallery condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), eq(variables['Publish'], 'True')) diff --git a/.ci/publishsymbols.yml b/.ci/publishsymbols.yml new file mode 100644 index 000000000..8c6dba383 --- /dev/null +++ b/.ci/publishsymbols.yml @@ -0,0 +1,39 @@ +parameters: + jobName1: publish_symbols_job + displayValidationJob1: 'Publish symbol to Microsoft symbol server' + +jobs: +- job: ${{ parameters.jobName1 }} + displayName: ${{ parameters.displayValidationJob1 }} + pool: + name: 1ES + demands: + - ImageOverride -equals PSMMS2019-Secure + timeoutInMinutes: 2880 # job times out in 2 days + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download and publish symbols' + inputs: + artifact: symbolfile + path: '$(Pipeline.Workspace)\symbolResult' + pattern: '**/*.pdb' + + - pwsh: | + $symbolsRoot = New-Item -Path "$(Pipeline.Workspace)/symbols" -ItemType Directory -Verbose + Copy-Item -Path "$(Pipeline.Workspace)\symbolResult\Microsoft.PowerShell.PSResourceGet.pdb" -Destination $symbolsRoot + + 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: Copy symbol file to path for task + + - task: PublishSymbols@2 + inputs: + symbolsFolder: '$(SymbolsPath)' + searchPattern: '*.pdb' + indexSources: false + publishSymbols: true + symbolServerType: teamServices + detailedLog: true