-
-
Notifications
You must be signed in to change notification settings - Fork 81
/
Loops.yml
76 lines (68 loc) · 3.14 KB
/
Loops.yml
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
# Loop steps allow to execute multiple times in a row (a sequence of) other steps.
# Nested loops are supported.
# NB: step execution events are triggered only for the outermost loop step
-
type: loop
repeat: int # number of times to repeat execution of the sequence of sub-steps
steps: # the migration steps that you want to be executed repeatedly
-
type: ...
mode: ...
etc: ... # New references that can be resolved anywhere inside the nested step definitions are `loop:iteration`
# and `loop:depth`.
# loop:iteration is the counter of the current loop iteration, starting at 1
# loop:depth is used to tell apart nested loops. I starts at depth 1
# f.e. you could use the following to create contents with different names: "Article [loop:depth].[loop:iteration]"
-
type: ...
mode: ...
etc: ...
if: # Optional. If set, the loop will be skipped unless the condition is matched
"reference:_ref_name": # name of a reference to be used for the test
_operator_: value # allowed operators: eq, gt, gte, lt, lte, ne, count, length, regexp, satisfies
# it is possible to loop over arrays values as well. This works like a php `foreach`
-
type: loop
over: "reference:some_array_reference" # an array (in the php sense, in yml we might call it either a list or an associative array)
steps: # the migration steps that you want to be executed repeatedly
-
type: ...
mode: ...
etc: ... # New references that can be resolved anywhere inside the nested step definitions are `loop:iteration`
# , `loop:depth`, `loop:key` and `loop:value`.
# loop:iteration is the counter of the current loop iteration, starting at 1
# loop:depth is used to tell apart nested loops. I starts at depth 1
# loop:key is the key of the current array element
# loop:value is the value of the current array element
-
type: ...
mode: ...
etc: ...
if: # Optional. If set, the loop will be skipped unless the condition is matched
"reference:_ref_name": # name of a reference to be used for the test
_operator_: value # allowed operators: eq, gt, gte, lt, lte, ne, count, length, regexp, satisfies
# Example: how to create a reference that holds a composite index of the current step in nested loops:
-
type: loop
repeat: 2
steps:
-
type: reference
mode: set
identifier: loopindex1
value: "[loop:iteration]"
overwrite: true
-
type: loop
repeat: 2
steps:
-
type: reference
mode: set
identifier: loopindex2
value: "[reference:loopindex1].[loop:iteration]"
overwrite: true
-
type: reference
mode: dump
identifier: reference:loopindex2