Skip to content

Commit e0b54b8

Browse files
authored
add publish pipeline (#344)
1 parent 7c8a5c0 commit e0b54b8

File tree

1 file changed

+281
-0
lines changed

1 file changed

+281
-0
lines changed

eng/publish/publish.yml

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
# This is our package-publishing pipeline.
2+
# When executed, it automatically publishes the output of the 'official pipeline' (the nupkgs) to our internal ADO feed.
3+
# It may optionally also publish the packages to NuGet, but that is gated behind a manual approval.
4+
5+
trigger: none # only trigger is manual
6+
pr: none # only trigger is manual
7+
8+
resources:
9+
repositories:
10+
- repository: 1es
11+
type: git
12+
name: 1ESPipelineTemplates/1ESPipelineTemplates
13+
ref: refs/tags/release
14+
- repository: eng
15+
type: git
16+
name: engineering
17+
ref: refs/tags/release
18+
19+
pipelines:
20+
- pipeline: officialPipeline # Reference to the pipeline to be used as an artifact source
21+
source: 'durabletask-dotnet.official'
22+
23+
extends:
24+
template: v1/1ES.Official.PipelineTemplate.yml@1es
25+
parameters:
26+
pool:
27+
name: 1es-pool-azfunc
28+
image: 1es-windows-2022
29+
os: windows
30+
31+
stages:
32+
- stage: release
33+
jobs:
34+
35+
# ADO release
36+
- job: AdoRelease
37+
displayName: ADO Release
38+
templateContext:
39+
type: releaseJob
40+
isProduction: true
41+
inputs:
42+
- input: pipelineArtifact
43+
pipeline: officialPipeline # Pipeline reference, as defined in the resources section
44+
artifactName: drop
45+
targetPath: $(System.DefaultWorkingDirectory)/drop
46+
steps:
47+
- task: 1ES.PublishNuget@1
48+
displayName: 'Push to durabletask ADO feed'
49+
inputs:
50+
command: push
51+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
52+
packagesToPush: '$(System.DefaultWorkingDirectory)/**/*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg'
53+
publishVstsFeed: '3f99e810-c336-441f-8892-84983093ad7f/c895696b-ce37-4fe7-b7ce-74333a04f8bf'
54+
allowPackageConflicts: true
55+
56+
# NuGet approval gate
57+
- job: nugetApproval
58+
displayName: NuGetApproval
59+
pool: server # This task only works when executed on serverl pools, so this needs to be specified
60+
steps:
61+
# Wait for manual approval.
62+
- task: ManualValidation@1
63+
inputs:
64+
instructions: Confirm you want to push to NuGet
65+
onTimeout: 'reject'
66+
67+
#================== NuGet publishing section ==================
68+
# Next, we publish the nupkgs to NuGet, one at a time; for good reason.
69+
#
70+
# When publishing to NuGet, the `1ES.PublishNuget@1` will fail the ADO job if we attempt
71+
# to push any package versions that were already uploaded to NuGet.
72+
# For instance, imagine the latest DTFx packages on NuGet are: [email protected] and [email protected]
73+
# and that our official pipeline generated these packages: [email protected] and [email protected].
74+
# In the end, we want NuGet to have both packages at version v1.1.
75+
#
76+
# In this case, if we try to publish both packages in the same ADO job, it will fail as soon as it detects
77+
# we're trying to push [email protected] as that already exists on NuGet, and this could prevent
78+
# [email protected] from being published in the first place.
79+
#
80+
# Unfortunately, skipping duplicate package versions is only supported for publishing to ADO feeds, which explains
81+
# why we did not have this issue when pushing to ADO.
82+
#
83+
# So we split each package upload to a separate job, so they be uploaded independently. In our example, the
84+
# DTFx.Core upload task would fail (as expected, it was already uploaded),
85+
# but the DTFx.AzureStorage upload would succeed.
86+
87+
# Implementor's note:
88+
# What follows could use some refactoring as there's a lot of repetition, perhaps an ADO template could hide the repeated details.
89+
# Pay close attention to the `packagesToPush` property of each job. We need to make sure the pattern specified there uniquely identifies
90+
# the package we want to push, and this is difficult when the full name of one package is the prefix of another.
91+
# For example: `Microsoft.DurableTask.Client` and `Microsoft.DurableTask.Client.Grpc`.
92+
# The trick is to exclude the `Microsoft.DurableTask.Client.Grpc` in the `packagesToPush` property for `Microsoft.DurableTask.Client`
93+
94+
# NuGet release (Microsoft.DurableTask.Abstractions)
95+
- job: nugetRelease_Microsoft_DurableTask_Abstractions
96+
displayName: NuGet Release (Microsoft.DurableTask.Abstractions)
97+
dependsOn: nugetApproval
98+
condition: succeeded('nugetApproval') # nuget packages need to be on ADO first
99+
templateContext:
100+
type: releaseJob
101+
isProduction: true
102+
inputs:
103+
- input: pipelineArtifact
104+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
105+
artifactName: drop
106+
targetPath: $(System.DefaultWorkingDirectory)/drop
107+
steps:
108+
- task: 1ES.PublishNuget@1
109+
displayName: 'NuGet push (Microsoft.DurableTask.Abstractions)'
110+
inputs:
111+
command: push
112+
nuGetFeedType: external
113+
publishFeedCredentials: 'DurableTask org NuGet API Key'
114+
packagesToPush: '$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Abstractions.*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg' # Despite this being a custom command, we need to keep this for 1ES validation
115+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
116+
117+
# NuGet release (Microsoft.DurableTask.Client)
118+
- job: nugetRelease_Microsoft_DurableTask_Client
119+
displayName: NuGet Release (Microsoft.DurableTask.Client)
120+
dependsOn: nugetApproval
121+
condition: succeeded('nugetApproval') # nuget packages need to be on ADO first
122+
templateContext:
123+
type: releaseJob
124+
isProduction: true
125+
inputs:
126+
- input: pipelineArtifact
127+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
128+
artifactName: drop
129+
targetPath: $(System.DefaultWorkingDirectory)/drop
130+
steps:
131+
- task: 1ES.PublishNuget@1
132+
displayName: 'NuGet push (Microsoft.DurableTask.Client)'
133+
inputs:
134+
command: push
135+
nuGetFeedType: external
136+
publishFeedCredentials: 'DurableTask org NuGet API Key'
137+
# the packages to push pattern explicitly excludes:
138+
# - 'Microsoft.DurableTask.Client.Grpc'
139+
# - 'Microsoft.DurableTask.Client.OrchestrationServiceClientShim'
140+
# which are pushed by their respective jobs
141+
packagesToPush: '$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Client.*.nupkg;!$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Client.Grpc.*.nupkg;!$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Client.OrchestrationServiceClientShim.*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg' # Despite this being a custom command, we need to keep this for 1ES validation
142+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
143+
144+
# NuGet release (Microsoft.DurableTask.Client.Grpc)
145+
- job: nugetRelease_Microsoft_DurableTask_Client_Grpc
146+
displayName: NuGet Release (Microsoft.DurableTask.Client.Grpc)
147+
dependsOn: nugetApproval
148+
condition: succeeded('nugetApproval') # nuget packages need to be on ADO first
149+
templateContext:
150+
type: releaseJob
151+
isProduction: true
152+
inputs:
153+
- input: pipelineArtifact
154+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
155+
artifactName: drop
156+
targetPath: $(System.DefaultWorkingDirectory)/drop
157+
steps:
158+
- task: 1ES.PublishNuget@1
159+
displayName: 'NuGet push (Microsoft.DurableTask.Client.Grpc)'
160+
inputs:
161+
command: push
162+
nuGetFeedType: external
163+
publishFeedCredentials: 'DurableTask org NuGet API Key'
164+
packagesToPush: '$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Client.Grpc.*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg' # Despite this being a custom command, we need to keep this for 1ES validation
165+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
166+
167+
# NuGet release (Microsoft.DurableTask.Client.OrchestrationServiceClientShim)
168+
- job: nugetRelease_Microsoft_DurableTask_Client_OrchestrationServiceClientShim
169+
displayName: NuGet Release (Microsoft.DurableTask.Client.OrchestrationServiceClientShim)
170+
dependsOn: nugetApproval
171+
condition: succeeded('nugetApproval') # nuget packages need to be on ADO first
172+
templateContext:
173+
type: releaseJob
174+
isProduction: true
175+
inputs:
176+
- input: pipelineArtifact
177+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
178+
artifactName: drop
179+
targetPath: $(System.DefaultWorkingDirectory)/drop
180+
steps:
181+
- task: 1ES.PublishNuget@1
182+
displayName: 'NuGet push (Microsoft.DurableTask.Client.OrchestrationServiceClientShim)'
183+
inputs:
184+
command: push
185+
nuGetFeedType: external
186+
publishFeedCredentials: 'DurableTask org NuGet API Key'
187+
packagesToPush: '$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Client.OrchestrationServiceClientShim.*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg' # Despite this being a custom command, we need to keep this for 1ES validation
188+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
189+
190+
# NuGet release (Microsoft.DurableTask.Generators)
191+
- job: nugetRelease_Microsoft_DurableTask_Generators
192+
displayName: NuGet Release (Microsoft.DurableTask.Generators)
193+
dependsOn: nugetApproval
194+
condition: succeeded('nugetApproval') # nuget packages need to be on ADO first
195+
templateContext:
196+
type: releaseJob
197+
isProduction: true
198+
inputs:
199+
- input: pipelineArtifact
200+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
201+
artifactName: drop
202+
targetPath: $(System.DefaultWorkingDirectory)/drop
203+
steps:
204+
- task: 1ES.PublishNuget@1
205+
displayName: 'NuGet push (Microsoft.DurableTask.Generators)'
206+
inputs:
207+
command: push
208+
nuGetFeedType: external
209+
publishFeedCredentials: 'DurableTask org NuGet API Key'
210+
packagesToPush: '$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Generators.*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg' # Despite this being a custom command, we need to keep this for 1ES validation
211+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
212+
213+
# NuGet release (Microsoft.DurableTask.Grpc)
214+
- job: nugetRelease_Microsoft_DurableTask_Grpc
215+
displayName: NuGet Release (Microsoft.DurableTask.Grpc)
216+
dependsOn: nugetApproval
217+
condition: succeeded('nugetApproval') # nuget packages need to be on ADO first
218+
templateContext:
219+
type: releaseJob
220+
isProduction: true
221+
inputs:
222+
- input: pipelineArtifact
223+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
224+
artifactName: drop
225+
targetPath: $(System.DefaultWorkingDirectory)/drop
226+
steps:
227+
- task: 1ES.PublishNuget@1
228+
displayName: 'NuGet push (Microsoft.DurableTask.Grpc)'
229+
inputs:
230+
command: push
231+
nuGetFeedType: external
232+
publishFeedCredentials: 'DurableTask org NuGet API Key'
233+
packagesToPush: '$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Grpc.*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg' # Despite this being a custom command, we need to keep this for 1ES validation
234+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
235+
236+
# NuGet release (Microsoft.DurableTask.Worker)
237+
- job: nugetRelease_Microsoft_DurableTask_Worker
238+
displayName: NuGet Release (Microsoft.DurableTask.Worker)
239+
dependsOn: nugetApproval
240+
condition: succeeded('nugetApproval') # nuget packages need to be on ADO first
241+
templateContext:
242+
type: releaseJob
243+
isProduction: true
244+
inputs:
245+
- input: pipelineArtifact
246+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
247+
artifactName: drop
248+
targetPath: $(System.DefaultWorkingDirectory)/drop
249+
steps:
250+
- task: 1ES.PublishNuget@1
251+
displayName: 'NuGet push (Microsoft.DurableTask.Worker)'
252+
inputs:
253+
command: push
254+
nuGetFeedType: external
255+
publishFeedCredentials: 'DurableTask org NuGet API Key'
256+
# the packages to push pattern explicitly excludes 'Microsoft.DurableTask.Worker.Grpc', which is pushed by another job in this file
257+
packagesToPush: '$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Worker.*.nupkg;!$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Worker.Grpc*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg' # Despite this being a custom command, we need to keep this for 1ES validation
258+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
259+
260+
# NuGet release (Microsoft.DurableTask.Worker.Grpc)
261+
- job: nugetRelease_Microsoft_DurableTask_Worker_Grpc
262+
displayName: NuGet Release (Microsoft.DurableTask.Worker.Grpc)
263+
dependsOn: nugetApproval
264+
condition: succeeded('nugetApproval') # nuget packages need to be on ADO first
265+
templateContext:
266+
type: releaseJob
267+
isProduction: true
268+
inputs:
269+
- input: pipelineArtifact
270+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
271+
artifactName: drop
272+
targetPath: $(System.DefaultWorkingDirectory)/drop
273+
steps:
274+
- task: 1ES.PublishNuget@1
275+
displayName: 'NuGet push (Microsoft.DurableTask.Worker.Grpc)'
276+
inputs:
277+
command: push
278+
nuGetFeedType: external
279+
publishFeedCredentials: 'DurableTask org NuGet API Key'
280+
packagesToPush: '$(System.DefaultWorkingDirectory)/drop/Microsoft.DurableTask.Worker.Grpc.*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg' # Despite this being a custom command, we need to keep this for 1ES validation
281+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling

0 commit comments

Comments
 (0)