1010# stages:
1111# - template: /eng/pipelines/onebranch/stages/release-stages.yml@self
1212# parameters:
13- # isOfficial: true # or false
14- # isDryRun: true # or false
13+ # isOfficial: true # or false
14+ # releaseToProduction: false # or true
1515# ...
1616#
1717# The isOfficial flag controls release-stage behaviour:
18- # - Official → Production environment, approval gate, dryRun parameter
19- # - Non-Official → Test environment, dry-run always enforced
18+ # - Official → Production environment, approval gate.
19+ # - Non-Official → Test environment.
20+ #
21+ # The releaseToProduction flag controls where packages are pushed:
22+ # - true → NuGet Production feed (via NuGetServiceConnectionProd).
23+ # - false → NuGet Test feed (via NuGetServiceConnectionTest).
2024#
2125# This template depends on stages defined by the build-stages.yml template.
2226#
@@ -36,33 +40,26 @@ parameters:
3640 - name : debug
3741 type : boolean
3842
39- # True for this to be a dry-run of the release portion of the pipeline. A dry run will ask
40- # for approvals and list the packages that would be released.
43+ # Controls where packages are pushed during the release stage.
4144 #
42- # When false, a release will actually push packages to NuGet.
45+ # When true, packages are pushed to the NuGet Production feed.
46+ # When false (default), packages are pushed to the NuGet Test feed.
4347 #
44- - name : isDryRun
48+ - name : releaseToProduction
4549 type : boolean
46- default : true
50+ default : false
4751
4852 # True for a OneBranch Official pipeline, false for a Non-Official pipeline.
4953 - name : isOfficial
5054 type : boolean
5155
52- # We must take these names as parameters because they are used in the stage name and display name,
53- # which cannot be computed within the template.
54-
55- # The stage name suffix.
56+ # The stage name suffix, used in the stage ID (e.g. release_production) and display name.
5657 - name : stageNameSuffix
5758 type : string
5859 values :
5960 - production
6061 - test
6162
62- # The stage display name.
63- - name : stageDisplayName
64- type : string
65-
6663 # ── Release parameters ─────────────────────────────────────────────────
6764
6865 - name : releaseSqlServerServer
@@ -90,13 +87,19 @@ stages:
9087 # Compile-time conditional: stage is removed entirely when no release
9188 # parameters are selected, avoiding OneBranch validation errors.
9289 #
93- # Official pipeline → Production environment, approval gate,
94- # dryRun controlled by releaseDryRun parameter.
95- # Non-official pipeline → Test/DryRun environment, dryRun always true.
90+ # Official pipeline → Production environment, approval gate.
91+ # Non-official pipeline → Test environment.
92+ #
93+ # releaseToProduction controls NuGet target:
94+ # true → NuGet Production feed.
95+ # false → NuGet Test feed.
9696 # ====================================================================
9797 - ${{ if or(parameters.releaseSqlServerServer, parameters.releaseLogging, parameters.releaseAbstractions, parameters.releaseSqlClient, parameters.releaseAzure, parameters.releaseAKVProvider) }} :
9898 - stage : release_${{ parameters.stageNameSuffix }}
99- displayName : ${{ parameters.stageDisplayName }}
99+ ${{ if eq(parameters.releaseToProduction, true) }} :
100+ displayName : Release to NuGet Production
101+ ${{ else }} :
102+ displayName : Release to NuGet Test
100103 dependsOn :
101104 - ${{ if or(parameters.releaseSqlServerServer, parameters.releaseLogging) }} :
102105 - build_independent
@@ -128,63 +131,80 @@ stages:
128131 - name : ob_deploymentjob_environment
129132 value : ${{ variables.onebranchDeploymentEnvironment }}
130133
134+ # NuGet service connection names used by the release stage to push packages.
135+ # These must match the ADO service connections configured with NuGet.org
136+ # credentials (API key or federated auth).
137+ - name : nugetServiceConnection
138+ ${{ if eq(parameters.releaseToProduction, true) }} :
139+ # https://sqlclientdrivers.visualstudio.com/ADO.Net/_settings/adminservices?resourceId=ee834e3a-87ad-4e9d-aa19-23711cfe4500
140+ value : ADO Nuget Org Connection
141+ ${{ else }} :
142+ # https://sqlclientdrivers.visualstudio.com/ADO.Net/_settings/adminservices?resourceId=4dd2f6b9-2696-4324-bee5-0b4f9c273098
143+ value : ADO Nuget Org Test Connection
144+
145+ - name : nugetTargetSuffix
146+ ${{ if eq(parameters.releaseToProduction, true) }} :
147+ value : ' (NuGet Production)'
148+ ${{ else }} :
149+ value : ' (NuGet Test)'
150+
131151 jobs :
132152 - ${{ if eq(parameters.releaseSqlServerServer, true) }} :
133153 - template : /eng/pipelines/onebranch/jobs/publish-nuget-package-job.yml@self
134154 parameters :
135155 packageName : Microsoft.SqlServer.Server
136156 artifactName : drop_build_independent_build_package_SqlServer
137157 packagePath : Microsoft.SqlServer.Server.$(effectiveSqlServerVersion).nupkg
138- nugetServiceConnection : $(NuGetServiceConnection)
158+ nugetServiceConnection : ${{ variables.nugetServiceConnection }}
139159 isProduction : ${{ parameters.isOfficial }}
140- isDryRun : ${{ parameters.isDryRun }}
160+ displaySuffix : ${{ variables.nugetTargetSuffix }}
141161
142162 - ${{ if eq(parameters.releaseLogging, true) }} :
143163 - template : /eng/pipelines/onebranch/jobs/publish-nuget-package-job.yml@self
144164 parameters :
145165 packageName : Microsoft.Data.SqlClient.Internal.Logging
146166 artifactName : drop_build_independent_build_package_Logging
147167 packagePath : Microsoft.Data.SqlClient.Internal.Logging.$(effectiveLoggingVersion).nupkg
148- nugetServiceConnection : $(NuGetServiceConnection)
168+ nugetServiceConnection : ${{ variables.nugetServiceConnection }}
149169 isProduction : ${{ parameters.isOfficial }}
150- isDryRun : ${{ parameters.isDryRun }}
170+ displaySuffix : ${{ variables.nugetTargetSuffix }}
151171
152172 - ${{ if eq(parameters.releaseAbstractions, true) }} :
153173 - template : /eng/pipelines/onebranch/jobs/publish-nuget-package-job.yml@self
154174 parameters :
155175 packageName : Microsoft.Data.SqlClient.Extensions.Abstractions
156176 artifactName : drop_build_abstractions_build_package_Abstractions
157177 packagePath : Microsoft.Data.SqlClient.Extensions.Abstractions.$(effectiveAbstractionsVersion).nupkg
158- nugetServiceConnection : $(NuGetServiceConnection)
178+ nugetServiceConnection : ${{ variables.nugetServiceConnection }}
159179 isProduction : ${{ parameters.isOfficial }}
160- isDryRun : ${{ parameters.isDryRun }}
180+ displaySuffix : ${{ variables.nugetTargetSuffix }}
161181
162182 - ${{ if eq(parameters.releaseSqlClient, true) }} :
163183 - template : /eng/pipelines/onebranch/jobs/publish-nuget-package-job.yml@self
164184 parameters :
165185 packageName : Microsoft.Data.SqlClient
166186 artifactName : drop_build_dependent_build_package_SqlClient
167187 packagePath : Microsoft.Data.SqlClient.$(effectiveSqlClientVersion).nupkg
168- nugetServiceConnection : $(NuGetServiceConnection)
188+ nugetServiceConnection : ${{ variables.nugetServiceConnection }}
169189 isProduction : ${{ parameters.isOfficial }}
170- isDryRun : ${{ parameters.isDryRun }}
190+ displaySuffix : ${{ variables.nugetTargetSuffix }}
171191
172192 - ${{ if eq(parameters.releaseAzure, true) }} :
173193 - template : /eng/pipelines/onebranch/jobs/publish-nuget-package-job.yml@self
174194 parameters :
175195 packageName : Microsoft.Data.SqlClient.Extensions.Azure
176196 artifactName : drop_build_dependent_build_package_Azure
177197 packagePath : Microsoft.Data.SqlClient.Extensions.Azure.$(effectiveAzureVersion).nupkg
178- nugetServiceConnection : $(NuGetServiceConnection)
198+ nugetServiceConnection : ${{ variables.nugetServiceConnection }}
179199 isProduction : ${{ parameters.isOfficial }}
180- isDryRun : ${{ parameters.isDryRun }}
200+ displaySuffix : ${{ variables.nugetTargetSuffix }}
181201
182202 - ${{ if eq(parameters.releaseAKVProvider, true) }} :
183203 - template : /eng/pipelines/onebranch/jobs/publish-nuget-package-job.yml@self
184204 parameters :
185205 packageName : Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider
186206 artifactName : drop_build_addons_build_package_AkvProvider
187207 packagePath : Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.$(effectiveAkvProviderVersion).nupkg
188- nugetServiceConnection : $(NuGetServiceConnection)
208+ nugetServiceConnection : ${{ variables.nugetServiceConnection }}
189209 isProduction : ${{ parameters.isOfficial }}
190- isDryRun : ${{ parameters.isDryRun }}
210+ displaySuffix : ${{ variables.nugetTargetSuffix }}
0 commit comments