-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow.json
More file actions
121 lines (121 loc) · 3.14 KB
/
Copy pathworkflow.json
File metadata and controls
121 lines (121 loc) · 3.14 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
{
"name": "two-way-sync",
"description": "Fetch records from two systems, compare via hashing, and sync differences to the target.",
"category": "integration",
"features": ["http", "crypto", "condition", "workflow.log"],
"input_schema": {
"type": "object",
"required": ["system_a_url", "system_b_url", "upsert_url"],
"properties": {
"system_a_url": {
"type": "string",
"description": "API endpoint to fetch records from system A"
},
"system_b_url": {
"type": "string",
"description": "API endpoint to fetch records from system B"
},
"upsert_url": {
"type": "string",
"description": "API endpoint to upsert record differences"
}
}
},
"definition": {
"timeout": "10m",
"on_timeout": "fail",
"steps": [
{
"id": "fetch-a",
"type": "action",
"action": "http.get",
"params": {
"url": "${{inputs.system_a_url}}"
},
"timeout": "30s",
"retry": {
"max": 2,
"backoff": "exponential",
"delay": "1s"
}
},
{
"id": "fetch-b",
"type": "action",
"action": "http.get",
"params": {
"url": "${{inputs.system_b_url}}"
},
"timeout": "30s",
"retry": {
"max": 2,
"backoff": "exponential",
"delay": "1s"
}
},
{
"id": "hash-a",
"type": "action",
"action": "crypto.hash",
"depends_on": ["fetch-a"],
"params": {
"data": "${{steps.fetch-a.output.status_code}}",
"algorithm": "sha256"
},
"timeout": "5s"
},
{
"id": "hash-b",
"type": "action",
"action": "crypto.hash",
"depends_on": ["fetch-b"],
"params": {
"data": "${{steps.fetch-b.output.status_code}}",
"algorithm": "sha256"
},
"timeout": "5s"
},
{
"id": "check-drift",
"type": "condition",
"depends_on": ["hash-a", "hash-b"],
"config": {
"expression": "steps['hash-a'].hash != steps['hash-b'].hash",
"branches": {
"true": [
{
"id": "sync-to-target",
"type": "action",
"action": "http.post",
"params": {
"url": "${{inputs.upsert_url}}",
"body": {
"action": "sync",
"source": "a",
"status_a": "${{steps.fetch-a.output.status_code}}",
"status_b": "${{steps.fetch-b.output.status_code}}"
}
},
"timeout": "30s",
"retry": {
"max": 2,
"backoff": "linear",
"delay": "2s"
}
}
]
}
}
},
{
"id": "log-result",
"type": "action",
"action": "workflow.log",
"depends_on": ["check-drift"],
"params": {
"message": "Two-way sync check complete"
}
}
]
}
}