Repository navigation
Expand file tree
/
Copy pathpipelines_template.yml
More file actions
388 lines (341 loc) · 18.3 KB
/
Copy pathpipelines_template.yml
File metadata and controls
388 lines (341 loc) · 18.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
#
# This file defines the rendering pipeline for the two-stack CMS.
#
# EXTENSIBILITY: For custom pipelines, it is common to copy this file to your own package,
# change the pipeline name, and the `Flowpack.DecoupledContentStore.contentReleasePipelineName` Setting.
#
# In this file, all "standard" modification points are marked with "Extension Point".
#
# The contents of this file is read by [prunner](https://github.com/Flowpack/prunner).
#
pipelines:
# ARG: contentReleaseId, currentContentReleaseId, validate
# the currentContentReleaseId is not used in any pipeline step here in the template, but is a common need in other
# use cases in extensions, e.g. calculating the differences between current and new release
do_content_release:
# crucial settings for incremental rendering to work
concurrency: 1
queue_limit: 1
queue_strategy: replace
# we want to keep the last 10 release's logs. You can adjust this to a setting which makes sense
# for your project. NOTE: to configure the retention period for the releases *themselves*,
# see Settings.yaml, path "Flowpack.DecoupledContentStore.redisContentStores.*.contentReleaseRetentionCount".
#
# Alternatively, you can specify a timespan in hours using `retention_period_hours`:
# retention_period_hours: 72
retention_count: 10
# Rendering reports "success" before validation, transfer and switch have run, so a later failure has to be
# written to the release, or the Backend UI shows it as successful once prunner has dropped this job.
on_error: &mark_release_failed
script:
- ./flow contentReleasePrepare:markFailed {{ .contentReleaseId }} {{ .__jobID }}
tasks:
################################################################################
# 0) PREPARE
################################################################################
prepare_finished:
script:
- ./flow contentReleasePrepare:createContentRelease {{ .contentReleaseId }} {{ .__jobID }} --workspaceName {{ .workspaceName }} --accountId {{ .accountId }}
- ./flow contentReleasePrepare:ensureAllOtherInProgressContentReleasesWillBeTerminated {{ .contentReleaseId }}
- ./flow contentReleasePrepare:flushContentCacheIfRequired {{ .contentReleaseId }} --flushContentCache={{ .flushContentCache }}
################################################################################
# 1) ENUMERATION
################################################################################
enumerate_nodes:
script:
- ./flow nodeEnumeration:enumerateAllNodes {{ .contentReleaseId }}
depends_on: [prepare_finished]
# Extension Point: If you want to enumerate additional things (not just nodes)
# add a new enumerate_* task here.
#
# 1) the task name must start with enumerate_ (to not break the UI)
# 2) the task name must be included in enumerate_finished.depends_on
# marker task to depend on all enumeration jobs; as separation between enumeration and rendering stages
enumerate_finished:
script: [""]
depends_on:
- enumerate_nodes
################################################################################
# 2) RENDERING
################################################################################
# the tasks anchored here (&name) are reused by do_quick_content_release below through a YAML alias (*name),
# so the two pipelines cannot drift apart. Editing one of them changes both - which is the intention; a task
# which has to differ is written out again down there instead.
render_orchestrator: &render_orchestrator
script:
- ./flow nodeRendering:orchestrateRendering {{ .contentReleaseId }}
depends_on: [enumerate_finished]
render_1: &render_1
script:
- Packages/Application/Flowpack.DecoupledContentStore/Scripts/renderWorker.sh {{ .contentReleaseId }} w1
depends_on: [enumerate_finished]
render_2: &render_2
script:
- Packages/Application/Flowpack.DecoupledContentStore/Scripts/renderWorker.sh {{ .contentReleaseId }} w2
depends_on: [enumerate_finished]
render_3: &render_3
script:
- Packages/Application/Flowpack.DecoupledContentStore/Scripts/renderWorker.sh {{ .contentReleaseId }} w3
depends_on: [enumerate_finished]
render_4: &render_4
script:
- Packages/Application/Flowpack.DecoupledContentStore/Scripts/renderWorker.sh {{ .contentReleaseId }} w4
depends_on: [enumerate_finished]
render_5:
script:
- Packages/Application/Flowpack.DecoupledContentStore/Scripts/renderWorker.sh {{ .contentReleaseId }} w5
depends_on: [enumerate_finished]
render_6:
script:
- Packages/Application/Flowpack.DecoupledContentStore/Scripts/renderWorker.sh {{ .contentReleaseId }} w6
depends_on: [enumerate_finished]
render_7:
script:
- Packages/Application/Flowpack.DecoupledContentStore/Scripts/renderWorker.sh {{ .contentReleaseId }} w7
depends_on: [enumerate_finished]
render_8:
script:
- Packages/Application/Flowpack.DecoupledContentStore/Scripts/renderWorker.sh {{ .contentReleaseId }} w8
depends_on: [enumerate_finished]
# Extension Point: If you want to render additional things (not just nodes)
# add a new render_* task here.
#
# 1) the task name must start with render_ (to not break the UI)
# 2) the task must include `depends_on: [enumerate_finished]` to be sorted at the correct pipeline step
# 3) the task name must be included in render_finished.depends_on
# marker task to depend on all rendering jobs; as separation between rendering and validation stages
render_finished:
script: [""]
depends_on:
- render_orchestrator
- render_1
- render_2
- render_3
- render_4
- render_5
- render_6
- render_7
- render_8
# IMPORTANT
# Steps 3 to 5 are used almost identically (only with variable redisInstanceIdentifier) below
# for the `manually_transfer_content_release` pipeline.
# If you change something you should change it in both places.
################################################################################
# 3) VALIDATION
################################################################################
validate_content:
script:
- |
{{ if .validate }} ./flow contentReleaseValidation:validate {{ .contentReleaseId }} {{ end }}
depends_on: [ render_finished ]
# Extension Point: If you want to validate additional things
# add a new validate_* task here.
#
# 1) the task name must start with validate_ (to not break the UI)
# 2) the task must include `depends_on: [render_finished]` to be sorted at the correct pipeline step
# 3) the task name must be included in validate_finished.depends_on
# marker task to depend on all validation jobs; as separation between validation and transfer stages
validate_finished: &validate_finished
script:
- ./flow contentReleaseValidation:ensureNoValidationErrorsExist {{ .contentReleaseId }}
depends_on:
- validate_content
################################################################################
# 4) TRANSFER
################################################################################
# By default, the transfer phase is empty. ("Minimal Setup" in the README)
transfer_content: &transfer_content
script:
# in case you want to use additional content stores, you need to enable the command
# below (see "Copy Content Releases to a different Redis instance" in README)
# and adjust the name of the redis instance you want to sync to ("live" in the
# invocation below).
- ""
# - ./flow contentReleaseTransfer:removeOldReleases target_live {{ .contentReleaseId }}
# - ./flow contentReleaseTransfer:transferToContentStore target_live {{ .contentReleaseId }}
depends_on: [validate_finished]
transfer_resources: &transfer_resources
script:
# in case you need to manually sync assets using rsync, you need to enable the command
# below (see "Manually Sync Assets to the Delivery Layer via RSync" in README)
- ""
#- ./flow contentReleaseTransfer:syncResources {{ .contentReleaseId }}
# Extension Point: If you want to transfer additional things
# add a new transfer_* task here.
#
# 1) the task name must start with transfer_ (to not break the UI)
# 2) the task must include `depends_on: [validate_finished]` to be sorted at the correct pipeline step
# 3) the task name must be included in transfer_finished.depends_on
# task to depend on all transfer jobs; as separation between transfer and switch stages
transfer_finished: &transfer_finished
script:
- ./flow contentReleaseTransfer:removeOldReleases primary {{ .contentReleaseId }}
depends_on:
- transfer_content
- transfer_resources
################################################################################
# 5) SWITCH
################################################################################
switch_primary: &switch_primary
script:
- ./flow contentReleaseSwitch:switchActiveContentRelease primary {{ .contentReleaseId }}
# in case you need want to switch the active content release in another content store,
# comment-in and adjust the line below (see "Copy Content Releases to a different Redis instance" in README).
# Do not forget to adjust the name of the redis instance you want to sync to ("live" in the invocation below).
#- ./flow contentReleaseSwitch:switchActiveContentRelease live {{ .contentReleaseId }}
depends_on:
- transfer_finished
switch_finished: &switch_finished
script: [""]
depends_on:
- switch_primary
# A quick content release publishes a handful of named document nodes without rendering everything else: it copies
# the release which is currently live and re-renders only the given nodes into that copy. Everything after the
# enumeration is the pipeline above, unchanged.
#
# ARG: contentReleaseId, currentContentReleaseId, quickPublishNodeIdentifiers, workspaceName, accountId
# the currentContentReleaseId is the release being copied here, so unlike in do_content_release it is required
do_quick_content_release:
# crucial settings for incremental rendering to work
concurrency: 1
# deliberately NOT `queue_strategy: replace` - a quick release publishes exactly the nodes somebody asked for, so
# a queued one must not be thrown away by the next one. ContentReleaseManager::startQuickContentRelease() refuses
# to schedule a second one while the first is still on its way, because its copy source is resolved when it is
# scheduled and would be the release the first one is about to replace.
# see the note on do_content_release above
retention_count: 10
on_error: *mark_release_failed
tasks:
################################################################################
# 0) PREPARE
################################################################################
# there is no flushContentCacheIfRequired here: this pipeline renders a few documents into a copy of a finished
# release, and contentReleaseQuickPublish:enumerateGivenNodes flushes the content cache for exactly those.
prepare_content_release:
script:
- ./flow contentReleasePrepare:createContentRelease {{ .contentReleaseId }} {{ .__jobID }} --workspaceName {{ .workspaceName }} --accountId {{ .accountId }}
- ./flow contentReleasePrepare:ensureAllOtherInProgressContentReleasesWillBeTerminated {{ .contentReleaseId }}
prepare_copy_previous_release:
script:
- ./flow contentReleaseQuickPublish:copyReleaseWithin primary {{ .currentContentReleaseId }} {{ .contentReleaseId }}
depends_on: [prepare_content_release]
# marker task to depend on all preparation jobs; as separation between preparation and enumeration stages
prepare_finished:
script: [""]
depends_on:
- prepare_copy_previous_release
################################################################################
# 1) ENUMERATION
################################################################################
enumerate_nodes:
script:
- ./flow contentReleaseQuickPublish:enumerateGivenNodes {{ .contentReleaseId }} {{ .quickPublishNodeIdentifiers }}
depends_on: [prepare_finished]
# Extension Point: see do_content_release above. Note that anything enumerated here is *added* to a copy of the
# previous release, so an enumeration which produces nothing leaves the copy as it is.
# marker task to depend on all enumeration jobs; as separation between enumeration and rendering stages
enumerate_finished:
script: [""]
depends_on:
- enumerate_nodes
################################################################################
# 2) RENDERING
################################################################################
# fewer workers than do_content_release: a quick release enumerates a handful of documents, so further workers
# would only add Flow bootstraps to the pipeline. `*name` is a YAML alias of the task anchored as `&name` in
# do_content_release above - depends_on names a task, and is resolved inside this pipeline
render_orchestrator: *render_orchestrator
render_1: *render_1
render_2: *render_2
render_3: *render_3
render_4: *render_4
# marker task to depend on all rendering jobs; as separation between rendering and validation stages
render_finished:
script: [""]
depends_on:
- render_orchestrator
- render_1
- render_2
- render_3
- render_4
################################################################################
# 3) VALIDATION
################################################################################
# unconditional, unlike in do_content_release: validation of a quick release is scoped to the URLs it rendered
# (see Flowpack\DecoupledContentStore\QuickPublish\ContentReleaseScope), so there is nothing to save by skipping it
validate_content:
script:
- ./flow contentReleaseValidation:validate {{ .contentReleaseId }}
depends_on: [render_finished]
validate_finished: *validate_finished
################################################################################
# 4) TRANSFER
################################################################################
# identical to do_content_release: the release is complete after the copy, so it is transferred as a whole -
# which also means the content stores you comment in up there are transferred to from here as well
transfer_content: *transfer_content
transfer_resources: *transfer_resources
transfer_finished: *transfer_finished
################################################################################
# 5) SWITCH
################################################################################
switch_primary: *switch_primary
switch_finished: *switch_finished
# this subset of the pipeline above is running when a release is manually transfered and switched live
# from the primary content store to any other content store
# ARG: contentReleaseId, currentContentReleaseId, redisInstanceId
manually_transfer_content_release:
# just to be safe, we want to run manual transfers one-by-one (without concurrency)
concurrency: 1
# we want to keep the last 10 manual transfer's logs. You can adjust this to a setting which makes sense
# for your project. NOTE: to configure the retention period for the releases *themselves*,
# see Settings.yaml, path "Flowpack.DecoupledContentStore.redisContentStores.*.contentReleaseRetentionCount".
#
# Alternatively, you can specify a timespan in hours using `retention_period_hours`:
# retention_period_hours: 72
retention_count: 10
tasks:
################################################################################
# 0) PREPARE
################################################################################
prepare_finished:
script:
- ./flow contentReleasePrepare:createContentRelease {{ .contentReleaseId }} {{ .__jobID }}
################################################################################
# 3) VALIDATION
################################################################################
validate_content:
script:
- ./flow contentReleaseValidation:validate {{ .contentReleaseId }}
depends_on: [ render_finished ]
validate_finished:
script:
- ./flow contentReleaseValidation:ensureNoValidationErrorsExist {{ .contentReleaseId }}
depends_on:
- validate_content
################################################################################
# 4) TRANSFER
################################################################################
transfer_content:
script: [""]
depends_on: [validate_finished]
transfer_resources:
script: [""]
transfer_finished:
script:
- ./flow contentReleaseTransfer:removeOldReleases {{ .redisInstanceId }} {{ .contentReleaseId }}
depends_on:
- transfer_content
- transfer_resources
################################################################################
# 5) SWITCH
################################################################################
switch_target:
script:
- ./flow contentReleaseSwitch:switchActiveContentRelease {{ .redisInstanceId }} {{ .contentReleaseId }}
depends_on:
- transfer_finished
switch_finished:
script: [""]
depends_on:
- switch_target