Skip to content

Commit 8d2483b

Browse files
authored
Symbols Publishing Follow-up (dotnet#4214)
1 parent eacf112 commit 8d2483b

5 files changed

Lines changed: 54 additions & 19 deletions

File tree

.github/instructions/onebranch-pipeline-design.instructions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ When adding a new csproj-based package:
7070
- The `publish-symbols-step.yml` accepts a `symbolsFolder` parameter to point at the downloaded PDB location
7171
- The publish step calls an extracted `publish-symbols.ps1` script with structured error handling and diagnostic logging
7272
- Symbols publishing credentials come from the `Symbols Publishing` variable group
73+
- In the official pipeline, symbol server destination follows `releaseToProduction`: Production when true, PPE when false
74+
- Non-official pipeline always targets the PPE symbol server
7375

7476
## Release Stage
7577

@@ -99,7 +101,9 @@ Release parameters (all boolean, default `false`):
99101
- `releaseSqlServerServer`, `releaseLogging`, `releaseAbstractions`, `releaseSqlClient`, `releaseAzure`, `releaseAKVProvider`
100102

101103
Official-only parameter:
102-
- `releaseToProduction` — push to NuGet Production feed (default `false`)
104+
- `releaseToProduction` — controls both NuGet target feed and symbol server destination (default `false`):
105+
- `true` → NuGet Production feed + Production symbol server
106+
- `false` → NuGet Test feed + PPE symbol server
103107

104108
When `isPreview` is true, pipeline resolves `effective*Version` variables to preview versions; otherwise GA versions. All versions defined in `variables/common-variables.yml`.
105109

eng/pipelines/onebranch/jobs/publish-symbols-job.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ jobs:
5454
- job: publish_symbols_${{ parameters.packageName }}
5555
displayName: 'Publish Symbols: ${{ parameters.packageFullName }}'
5656
pool:
57-
type: windows
57+
type: linux
5858

5959
variables:
60-
# OneBranch requires ob_outputDirectory to be set, even if this job produces no artifacts.
61-
ob_outputDirectory: $(JOB_OUTPUT)
60+
# OneBranch requires ob_outputDirectory to be set. Pipeline Artifacts are always on and
61+
# cannot be disabled. To prevent this job from publishing artifacts, a .artifactignore
62+
# that excludes all files is written into ob_outputDirectory before the auto-publish step.
63+
ob_outputDirectory: $(Build.SourcesDirectory)/no_publish
6264

6365
# Disable SDL scanning — this job only uploads/publishes PDBs and produces no
6466
# assemblies to scan. APIScan and BinSkim are handled by the build jobs.
@@ -72,7 +74,24 @@ jobs:
7274
# Path to the PDB files within the downloaded artifact.
7375
symbolsPath: $(Pipeline.Workspace)/${{ parameters.artifactName }}/symbols
7476

77+
# PublishSymbols@2 runs on the OneBranch host agent (outside the build container) due to 1ES
78+
# Pipeline Template credential isolation. On Linux, the host resolves to the Microsoft org by
79+
# default. Setting this variable at job level ensures the task sees it and connects to the
80+
# correct org's symbol store.
81+
#
82+
# Reference:
83+
# https://www.osgwiki.com/wiki/Symbols_Publishing_Pipeline_to_SymWeb_and_MSDL#Option_B:_OneBranch
84+
#
85+
ArtifactServices.Symbol.AccountName: ${{ parameters.symbolsUploadAccount }}
86+
7587
steps:
88+
# Create ob_outputDirectory with a .artifactignore that excludes everything,
89+
# so OneBranch's auto-publish uploads an empty artifact.
90+
- pwsh: |
91+
New-Item -Path "$(ob_outputDirectory)" -ItemType Directory -Force
92+
"**" | Out-File -FilePath "$(ob_outputDirectory)/.artifactignore" -Encoding ascii
93+
displayName: 'Suppress artifact publishing'
94+
7695
- task: DownloadPipelineArtifact@2
7796
displayName: 'Download ${{ parameters.packageFullName }} Artifact'
7897
inputs:

eng/pipelines/onebranch/sqlclient-official.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ parameters:
3333
type: boolean
3434
default: false
3535

36-
# Push packages to NuGet Production (otherwise pushes to NuGet Test).
36+
# When true, publish symbols and push NuGet packages to Production environments. When false,
37+
# symbols use PPE and NuGet packages use QA/Test.
3738
- name: releaseToProduction
38-
displayName: Release to NuGet Production
39+
displayName: Publish Symbols and NuGet Packages to Production
3940
type: boolean
4041
default: false
4142

@@ -254,9 +255,14 @@ extends:
254255

255256
symbolsAzureSubscription: '$(SymbolsAzureSubscription)'
256257
symbolsPublishProjectName: '$(SymbolsPublishProjectNameSqlClient)'
257-
# Official pipelines must publish to the Production symbol server.
258-
symbolsPublishServer: '$(SymbolsPublishServerProd)'
259-
symbolsPublishTokenUri: '$(SymbolsPublishTokenUriProd)'
258+
# Symbol server target follows releaseToProduction: Production for
259+
# real releases, PPE for test/QA releases.
260+
${{ if eq(parameters.releaseToProduction, true) }}:
261+
symbolsPublishServer: '$(SymbolsPublishServerProd)'
262+
symbolsPublishTokenUri: '$(SymbolsPublishTokenUriProd)'
263+
${{ else }}:
264+
symbolsPublishServer: '$(SymbolsPublishServerPPE)'
265+
symbolsPublishTokenUri: '$(SymbolsPublishTokenUriPPE)'
260266
symbolsUploadAccount: '$(SymbolsUploadAccount)'
261267

262268
- template: /eng/pipelines/onebranch/stages/release-stages.yml@self

eng/pipelines/onebranch/steps/publish-symbols-step.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ parameters:
7575
type: string
7676

7777
steps:
78-
# Set variable for downstream tasks (allegedly).
78+
# NOTE: ArtifactServices.Symbol.AccountName is set as a job-level variable in
79+
# publish-symbols-job.yml. On OneBranch Linux agents, PublishSymbols@2 runs on the host (outside
80+
# the build container) due to 1ES PT credential isolation. A ##vso[task.setvariable] inside the
81+
# container is not visible to host-level tasks, so the variable must be declared at job scope.
7982
#
80-
# Note: Because variables cannot be set in top-level of template, this has to be done during
81-
# runtime.
82-
#
83-
- script: 'echo ##vso[task.setvariable variable=ArtifactServices.Symbol.AccountName;]${{ parameters.uploadAccount }}'
84-
displayName: 'Set ArtifactServices.Symbol.AccountName to ${{ parameters.uploadAccount }}'
83+
# Reference:
84+
# https://www.osgwiki.com/wiki/Symbols_Publishing_Pipeline_to_SymWeb_and_MSDL#Option_B:_OneBranch
8585

86-
# Log the PDB files that match the search pattern so we can verify no
87-
# unexpected files are included in the upload.
86+
# Log the PDB files that match the search pattern so we can verify no unexpected files are
87+
# included in the upload.
8888
- pwsh: |
8989
$folder = '${{ parameters.symbolsFolder }}'
9090
$glob = '${{ parameters.searchPattern }}'

eng/pipelines/onebranch/variables/onebranch-variables.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ variables:
3939
- name: Packaging.EnableSBOMSigning
4040
value: true
4141

42-
# Docker image which is used to build the project https://aka.ms/obpipelines/containers
42+
# OneBranch supplies a variety of container images we must use for our jobs.
43+
#
44+
# Windows jobs use this image.
4345
- name: WindowsContainerImage
44-
value: "onebranch.azurecr.io/windows/ltsc2022/vse2022:latest"
46+
value: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest
47+
48+
# Linux jobs use this image.
49+
- name: LinuxContainerImage
50+
value: mcr.microsoft.com/onebranch/azurelinux/build:3.0

0 commit comments

Comments
 (0)