forked from k1LoW/runn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunbook.schema.yaml
More file actions
444 lines (429 loc) · 12.5 KB
/
runbook.schema.yaml
File metadata and controls
444 lines (429 loc) · 12.5 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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# JSON Schema for runn runbook YAML files
# https://github.com/k1LoW/runn
"$schema": https://json-schema.org/draft/2020-12/schema
"$id": https://raw.githubusercontent.com/k1LoW/runn/main/runbook.schema.yaml
title: runn runbook
description: Schema for runn runbook YAML files
type: object
properties:
desc:
type: string
description: Description of the runbook
labels:
type: array
items:
type: string
pattern: "^[^ \\n\\r!+=|.*%^?><]+$"
description: Labels for filtering runbooks
needs:
type: object
additionalProperties:
type: string
description: "Inter-runbook dependencies (key: alias, value: path)"
runners:
type: object
additionalProperties:
"$ref": "#/$defs/runnerDefinition"
description: "Runner definitions (key: runner name, value: config)"
vars:
type: object
additionalProperties: true
description: Variable definitions
secrets:
type: array
items:
type: string
description: Secret variable names to mask in output
steps:
"$ref": "#/$defs/steps"
hostRules:
type: object
additionalProperties:
type: string
description: "Host rewriting rules (key: original host, value: replacement host)"
debug:
type: [boolean, string]
description: Enable debug mode
interval:
type: string
description: Interval between steps (duration string)
if:
type: [string, boolean]
description: Conditional execution expression for the entire runbook
skipTest:
type: [boolean, string]
description: Skip test assertions in this runbook
loop:
"$ref": "#/$defs/loopValue"
concurrency:
"$ref": "#/$defs/concurrencyValue"
force:
type: [boolean, string]
description: Continue execution even when a step fails
trace:
type: [boolean, string]
description: Enable tracing (e.g. add trace header to HTTP request)
required: []
additionalProperties: true
"$defs":
steps:
description: Steps to execute (array or named map)
oneOf:
- type: array
items:
"$ref": "#/$defs/step"
minItems: 1
- type: object
additionalProperties:
"$ref": "#/$defs/step"
minProperties: 1
step:
description: A single execution step
type: object
properties:
if:
type: string
description: Conditional execution expression
desc:
type: string
description: Step description
loop:
"$ref": "#/$defs/loopValue"
defer:
type: [boolean, string]
description: Defer step execution until after all regular steps
force:
type: [boolean, string]
description: Continue execution even when this step fails
test:
description: Test assertion (expr expression or boolean)
oneOf:
- type: string
- type: boolean
dump:
"$ref": "#/$defs/dumpValue"
bind:
type: object
additionalProperties: true
description: "Variable binding (key: variable name, value: expr expression)"
include:
"$ref": "#/$defs/includeStepValue"
exec:
"$ref": "#/$defs/execStepValue"
runner:
type: object
additionalProperties: true
description: Dynamic runner definition at runtime
# Steps contain dynamic runner keys (e.g. "myapi:", "mydb:") defined in the top-level "runners:" section.
# These keys cannot be enumerated statically, so additionalProperties must be true.
additionalProperties: true
runnerDefinition:
description: Runner configuration (string DSN/URL or config object)
oneOf:
- type: string
- "$ref": "#/$defs/httpRunnerConfig"
- "$ref": "#/$defs/grpcRunnerConfig"
- "$ref": "#/$defs/dbRunnerConfig"
- "$ref": "#/$defs/cdpRunnerConfig"
- "$ref": "#/$defs/sshRunnerConfig"
- "$ref": "#/$defs/includeRunnerConfig"
httpRunnerConfig:
type: object
properties:
endpoint:
type: string
description: HTTP endpoint URL
openapi3:
type: string
description: Path to OpenAPI 3.0 document
skipValidateRequest:
type: [boolean, string]
description: Skip request validation with OpenAPI document
skipValidateResponse:
type: [boolean, string]
description: Skip response validation with OpenAPI document
skipCircularReferenceCheck:
type: [boolean, string]
description: Skip circular reference check in OpenAPI document
notFollowRedirect:
type: [boolean, string]
description: Do not follow HTTP redirects
multipartBoundary:
type: string
description: Custom boundary for multipart requests
cacert:
type: string
description: Path to CA certificate
cert:
type: string
description: Path to client certificate
key:
type: string
description: Path to client key
skipVerify:
type: [boolean, string]
description: Skip TLS verification
timeout:
type: string
description: Request timeout (duration string)
useCookie:
type: [boolean, string]
description: Enable cookie jar
trace:
"$ref": "#/$defs/traceConfig"
required: [endpoint]
additionalProperties: false
grpcRunnerConfig:
type: object
properties:
addr:
type: string
description: gRPC server address
tls:
type: [boolean, string]
description: Enable TLS
cacert:
type: string
description: Path to CA certificate
cert:
type: string
description: Path to client certificate
key:
type: string
description: Path to client key
skipVerify:
type: [boolean, string]
description: Skip TLS verification
importPaths:
type: array
items:
type: string
description: Proto import paths
protos:
type: array
items:
type: string
description: Proto file paths
bufDirs:
type: array
items:
type: string
description: Buf directories
bufLocks:
type: array
items:
type: string
description: Buf lock file paths
bufConfigs:
type: array
items:
type: string
description: Buf config file paths
bufModules:
type: array
items:
type: string
description: Buf module paths
trace:
"$ref": "#/$defs/traceConfig"
required: [addr]
additionalProperties: false
dbRunnerConfig:
type: object
properties:
dsn:
type: string
description: Database connection DSN
trace:
type: [boolean, string]
description: Enable query tracing
required: [dsn]
additionalProperties: false
sshRunnerConfig:
type: object
properties:
host:
type: string
description: SSH host (alias for sshConfig lookup)
hostname:
type: string
description: SSH hostname
sshConfig:
type: string
description: Path to SSH config file
user:
type: string
description: SSH user
port:
type: [integer, string]
description: SSH port
identityFile:
type: string
description: Path to SSH identity file
identityKey:
type: string
description: SSH identity key content
keepSession:
type: [boolean, string]
description: Keep SSH session alive between steps
localForward:
type: string
description: "Local port forwarding (e.g. 'localhost:8080:localhost:80')"
keyboardInteractive:
type: array
items:
type: object
properties:
match:
type: string
answer:
type: string
required: [match, answer]
additionalProperties: false
description: Keyboard-interactive authentication answers
anyOf:
- required: [host]
- required: [hostname]
additionalProperties: false
cdpRunnerConfig:
type: object
properties:
addr:
type: string
description: Chrome DevTools Protocol address
flags:
type: object
additionalProperties: true
description: Chrome flags
timeout:
type: string
description: Timeout for each CDP step (duration string)
additionalProperties: false
includeRunnerConfig:
type: object
properties:
path:
type: string
description: Path to the runbook to include
params:
type: object
additionalProperties: true
description: Parameters to pass to the included runbook
required: [path]
additionalProperties: false
traceConfig:
description: Trace configuration (boolean or object)
oneOf:
- type: [boolean, string]
- type: object
properties:
enable:
type: [boolean, string]
description: Enable tracing
headerName:
type: string
description: Custom trace header name
additionalProperties: false
execStepValue:
type: object
properties:
command:
type: string
description: Command to execute
stdin:
type: string
description: Standard input to the command
shell:
type: string
description: "Shell to use (e.g. 'bash', 'sh')"
background:
type: [boolean, string]
description: Run command in background
liveOutput:
type: [boolean, string]
description: Show live output
env:
type: object
additionalProperties:
type: string
description: Environment variables
required: [command]
additionalProperties: false
includeStepValue:
description: Include another runbook (string path or config object)
oneOf:
- type: string
- type: object
properties:
path:
type: string
description: Path to the runbook to include
vars:
type: object
additionalProperties: true
description: Variables to pass to the included runbook
skipTest:
type: [boolean, string]
description: Skip test assertions in the included runbook
force:
type: [boolean, string]
description: Force continue on error in the included runbook
required: [path]
additionalProperties: false
dumpValue:
description: Dump value (string expression or config object)
oneOf:
- type: string
- type: object
properties:
expr:
# No type constraint: expr accepts any YAML value (string, number, etc.)
description: Expression to evaluate and dump
out:
type: string
description: Output file path
disableTrailingNewline:
type: [boolean, string]
description: Disable trailing newline in output
disableMaskingSecrets:
type: [boolean, string]
description: Disable masking of secret values
required: [expr]
additionalProperties: false
loopValue:
description: Loop configuration (integer count, string expression, or config object)
oneOf:
- type: integer
minimum: 0
- type: string
- type: object
properties:
count:
type: [string, integer]
description: Number of iterations (expr expression or integer string)
interval:
type: [string, number]
description: Interval between iterations (duration string, number is treated as seconds)
minInterval:
type: [string, number]
description: Minimum interval for exponential backoff (duration string, number is treated as seconds)
maxInterval:
type: [string, number]
description: Maximum interval for exponential backoff (duration string, number is treated as seconds)
jitter:
type: number
description: Jitter factor for backoff
multiplier:
type: number
description: Multiplier for exponential backoff
until:
type: string
description: Loop until this expression evaluates to true
additionalProperties: false
concurrencyValue:
description: Concurrency key(s) for parallel execution
oneOf:
- type: string
- type: array
items:
type: string