@solid-stack/builder 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +467 -100
- package/dist/bin.js.map +1 -1
- package/dist/core/composition/compileServiceComposition.d.ts +2 -0
- package/dist/core/composition/compileServiceComposition.d.ts.map +1 -1
- package/dist/core/composition/composeBuildResources.d.ts +6 -0
- package/dist/core/composition/composeBuildResources.d.ts.map +1 -0
- package/dist/core/composition/composeDependsOn.d.ts +3 -0
- package/dist/core/composition/composeDependsOn.d.ts.map +1 -0
- package/dist/core/composition/composeEnvironment.d.ts +2 -2
- package/dist/core/composition/composeEnvironment.d.ts.map +1 -1
- package/dist/core/composition/composeHealthcheck.d.ts +3 -0
- package/dist/core/composition/composeHealthcheck.d.ts.map +1 -0
- package/dist/core/composition/composePaths.d.ts +2 -0
- package/dist/core/composition/composePaths.d.ts.map +1 -1
- package/dist/core/composition/generatedNames.d.ts +9 -0
- package/dist/core/composition/generatedNames.d.ts.map +1 -0
- package/dist/core/composition/namespaceDependencyCompose.d.ts +3 -0
- package/dist/core/composition/namespaceDependencyCompose.d.ts.map +1 -1
- package/dist/core/composition/types.d.ts +8 -3
- package/dist/core/composition/types.d.ts.map +1 -1
- package/dist/core/composition/validateComposeResourceReferences.d.ts +7 -0
- package/dist/core/composition/validateComposeResourceReferences.d.ts.map +1 -0
- package/dist/core/composition/validateDependencyCompose.d.ts.map +1 -1
- package/dist/core/composition/validateOverrideCompose.d.ts +10 -3
- package/dist/core/composition/validateOverrideCompose.d.ts.map +1 -1
- package/dist/core/config/pathSafety.d.ts.map +1 -1
- package/dist/core/mesh/checkers/checkMeshServices.d.ts.map +1 -1
- package/dist/core/mesh/runners/runMeshTestUnit.d.ts.map +1 -1
- package/dist/core/mesh/v2/compileMeshComposition.d.ts.map +1 -1
- package/dist/core/mesh/v2/compileMeshTester.d.ts +2 -1
- package/dist/core/mesh/v2/compileMeshTester.d.ts.map +1 -1
- package/dist/core/mesh/v2/validateMeshTestStage.d.ts +22 -0
- package/dist/core/mesh/v2/validateMeshTestStage.d.ts.map +1 -0
- package/dist/index.js +467 -100
- package/dist/index.js.map +1 -1
- package/dist/templates/policy/dockerfile/dockerfile.rego +6 -9
- package/dist/utils/assertUniqueHostPortMappings.d.ts.map +1 -1
- package/dist/utils/checkPortCollision.d.ts.map +1 -1
- package/dist/utils/composePublishedPort.d.ts +3 -0
- package/dist/utils/composePublishedPort.d.ts.map +1 -0
- package/package.json +1 -1
- package/schemas/mesh-schema.json +310 -20
- package/templates/policy/dockerfile/dockerfile.rego +6 -9
|
@@ -21,7 +21,10 @@ parent[a] := lower(input[i].Value[0]) if {
|
|
|
21
21
|
edges := {a: neighbors | some i; a := alias_at[i]; neighbors := [p | p := parent[a]]}
|
|
22
22
|
lineage[a] := graph.reachable(edges, {a}) | {a} if { some i; a := alias_at[i] }
|
|
23
23
|
commands[a] := {i | some i; stage_at[i] in lineage[a]; input[i].Cmd == "cmd"} if { some j; a := alias_at[j] }
|
|
24
|
-
|
|
24
|
+
healthcheck_indices[a] := {i | some i; stage_at[i] in lineage[a]; input[i].Cmd == "healthcheck"} if { some j; a := alias_at[j] }
|
|
25
|
+
effective_healthcheck_index[a] := max(indices) if { indices := healthcheck_indices[a]; count(indices) > 0 }
|
|
26
|
+
effective_healthcheck_value[a] := lower(concat(" ", input[index].Value)) if { index := effective_healthcheck_index[a] }
|
|
27
|
+
has_valid_effective_healthcheck(a) if { value := effective_healthcheck_value[a]; value != "none" }
|
|
25
28
|
artifact_copies[a] := {i | some i; stage_at[i] in lineage[a]; input[i].Cmd == "copy"; startswith(lower(input[i].Flags[_]), "--from=")} if { some j; a := alias_at[j] }
|
|
26
29
|
|
|
27
30
|
deny contains msg if {
|
|
@@ -31,8 +34,8 @@ deny contains msg if {
|
|
|
31
34
|
}
|
|
32
35
|
deny contains "Hardcoded EXPOSE is forbidden; Builder owns endpoint publication" if { some i; input[i].Cmd == "expose" }
|
|
33
36
|
deny contains "dev stage requires a default CMD" if { "dev" in stages; count(commands.dev) == 0 }
|
|
34
|
-
deny contains "dev stage requires a valid HEALTHCHECK" if { "dev" in stages;
|
|
35
|
-
deny contains "prod stage requires a valid HEALTHCHECK" if { "prod" in stages;
|
|
37
|
+
deny contains "dev stage requires a valid HEALTHCHECK" if { "dev" in stages; not has_valid_effective_healthcheck("dev") }
|
|
38
|
+
deny contains "prod stage requires a valid HEALTHCHECK" if { "prod" in stages; not has_valid_effective_healthcheck("prod") }
|
|
36
39
|
deny contains "prod stage requires COPY --from= artifact isolation" if { "prod" in stages; count(artifact_copies.prod) == 0 }
|
|
37
40
|
deny contains msg if {
|
|
38
41
|
some i
|
|
@@ -48,12 +51,6 @@ deny contains msg if {
|
|
|
48
51
|
regex.match("(^|[ ;])nohup[ ;]|&[[:space:]]*$|pm2[[:space:]]+start.*--daemon|nginx(.*[[:space:]])?-g[[:space:]]*['\"]?daemon[[:space:]]+on", command)
|
|
49
52
|
msg := sprintf("Runtime CMD must remain in foreground (instruction %v)", [i])
|
|
50
53
|
}
|
|
51
|
-
deny contains msg if {
|
|
52
|
-
some i
|
|
53
|
-
input[i].Cmd == "healthcheck"
|
|
54
|
-
lower(concat(" ", input[i].Value)) == "none"
|
|
55
|
-
msg := sprintf("HEALTHCHECK NONE is forbidden (instruction %v)", [i])
|
|
56
|
-
}
|
|
57
54
|
deny contains msg if {
|
|
58
55
|
some i
|
|
59
56
|
input[i].Cmd == "cmd"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertUniqueHostPortMappings.d.ts","sourceRoot":"","sources":["../../src/utils/assertUniqueHostPortMappings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assertUniqueHostPortMappings.d.ts","sourceRoot":"","sources":["../../src/utils/assertUniqueHostPortMappings.ts"],"names":[],"mappings":"AAIA,gFAAgF;AAChF,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAgBrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPortCollision.d.ts","sourceRoot":"","sources":["../../src/utils/checkPortCollision.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkPortCollision.d.ts","sourceRoot":"","sources":["../../src/utils/checkPortCollision.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAkB7D;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAehE;AAED,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAS5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composePublishedPort.d.ts","sourceRoot":"","sources":["../../src/utils/composePublishedPort.ts"],"names":[],"mappings":"AAUA,6EAA6E;AAC7E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CA+BzE"}
|
package/package.json
CHANGED
package/schemas/mesh-schema.json
CHANGED
|
@@ -52,8 +52,26 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"type": "object",
|
|
54
54
|
"additionalProperties": {
|
|
55
|
-
"
|
|
56
|
-
|
|
55
|
+
"allOf": [
|
|
56
|
+
{
|
|
57
|
+
"type": "string",
|
|
58
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"not": {
|
|
62
|
+
"enum": [
|
|
63
|
+
"app",
|
|
64
|
+
"dependencies",
|
|
65
|
+
"tester",
|
|
66
|
+
"services",
|
|
67
|
+
"dev",
|
|
68
|
+
"prod",
|
|
69
|
+
"test",
|
|
70
|
+
"e2e"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]
|
|
57
75
|
},
|
|
58
76
|
"propertyNames": {
|
|
59
77
|
"pattern": "^[a-z][a-z0-9-]*$"
|
|
@@ -62,8 +80,26 @@
|
|
|
62
80
|
"dependsOn": {
|
|
63
81
|
"type": "array",
|
|
64
82
|
"items": {
|
|
65
|
-
"
|
|
66
|
-
|
|
83
|
+
"allOf": [
|
|
84
|
+
{
|
|
85
|
+
"type": "string",
|
|
86
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"not": {
|
|
90
|
+
"enum": [
|
|
91
|
+
"app",
|
|
92
|
+
"dependencies",
|
|
93
|
+
"tester",
|
|
94
|
+
"services",
|
|
95
|
+
"dev",
|
|
96
|
+
"prod",
|
|
97
|
+
"test",
|
|
98
|
+
"e2e"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
67
103
|
}
|
|
68
104
|
},
|
|
69
105
|
"publish": {
|
|
@@ -77,6 +113,28 @@
|
|
|
77
113
|
"path"
|
|
78
114
|
],
|
|
79
115
|
"additionalProperties": false
|
|
116
|
+
},
|
|
117
|
+
"propertyNames": {
|
|
118
|
+
"allOf": [
|
|
119
|
+
{
|
|
120
|
+
"type": "string",
|
|
121
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"not": {
|
|
125
|
+
"enum": [
|
|
126
|
+
"app",
|
|
127
|
+
"dependencies",
|
|
128
|
+
"tester",
|
|
129
|
+
"services",
|
|
130
|
+
"dev",
|
|
131
|
+
"prod",
|
|
132
|
+
"test",
|
|
133
|
+
"e2e"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]
|
|
80
138
|
}
|
|
81
139
|
},
|
|
82
140
|
"dev": {
|
|
@@ -100,8 +158,26 @@
|
|
|
100
158
|
"dependencies": {
|
|
101
159
|
"type": "object",
|
|
102
160
|
"additionalProperties": {
|
|
103
|
-
"
|
|
104
|
-
|
|
161
|
+
"allOf": [
|
|
162
|
+
{
|
|
163
|
+
"type": "string",
|
|
164
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"not": {
|
|
168
|
+
"enum": [
|
|
169
|
+
"app",
|
|
170
|
+
"dependencies",
|
|
171
|
+
"tester",
|
|
172
|
+
"services",
|
|
173
|
+
"dev",
|
|
174
|
+
"prod",
|
|
175
|
+
"test",
|
|
176
|
+
"e2e"
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
]
|
|
105
181
|
},
|
|
106
182
|
"propertyNames": {
|
|
107
183
|
"pattern": "^[a-z][a-z0-9-]*$"
|
|
@@ -110,8 +186,26 @@
|
|
|
110
186
|
"dependsOn": {
|
|
111
187
|
"type": "array",
|
|
112
188
|
"items": {
|
|
113
|
-
"
|
|
114
|
-
|
|
189
|
+
"allOf": [
|
|
190
|
+
{
|
|
191
|
+
"type": "string",
|
|
192
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"not": {
|
|
196
|
+
"enum": [
|
|
197
|
+
"app",
|
|
198
|
+
"dependencies",
|
|
199
|
+
"tester",
|
|
200
|
+
"services",
|
|
201
|
+
"dev",
|
|
202
|
+
"prod",
|
|
203
|
+
"test",
|
|
204
|
+
"e2e"
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
115
209
|
}
|
|
116
210
|
},
|
|
117
211
|
"publish": {
|
|
@@ -122,6 +216,28 @@
|
|
|
122
216
|
}
|
|
123
217
|
},
|
|
124
218
|
"additionalProperties": false
|
|
219
|
+
},
|
|
220
|
+
"propertyNames": {
|
|
221
|
+
"allOf": [
|
|
222
|
+
{
|
|
223
|
+
"type": "string",
|
|
224
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"not": {
|
|
228
|
+
"enum": [
|
|
229
|
+
"app",
|
|
230
|
+
"dependencies",
|
|
231
|
+
"tester",
|
|
232
|
+
"services",
|
|
233
|
+
"dev",
|
|
234
|
+
"prod",
|
|
235
|
+
"test",
|
|
236
|
+
"e2e"
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
]
|
|
125
241
|
}
|
|
126
242
|
}
|
|
127
243
|
},
|
|
@@ -148,8 +264,26 @@
|
|
|
148
264
|
"dependencies": {
|
|
149
265
|
"type": "object",
|
|
150
266
|
"additionalProperties": {
|
|
151
|
-
"
|
|
152
|
-
|
|
267
|
+
"allOf": [
|
|
268
|
+
{
|
|
269
|
+
"type": "string",
|
|
270
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"not": {
|
|
274
|
+
"enum": [
|
|
275
|
+
"app",
|
|
276
|
+
"dependencies",
|
|
277
|
+
"tester",
|
|
278
|
+
"services",
|
|
279
|
+
"dev",
|
|
280
|
+
"prod",
|
|
281
|
+
"test",
|
|
282
|
+
"e2e"
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
]
|
|
153
287
|
},
|
|
154
288
|
"propertyNames": {
|
|
155
289
|
"pattern": "^[a-z][a-z0-9-]*$"
|
|
@@ -158,8 +292,26 @@
|
|
|
158
292
|
"dependsOn": {
|
|
159
293
|
"type": "array",
|
|
160
294
|
"items": {
|
|
161
|
-
"
|
|
162
|
-
|
|
295
|
+
"allOf": [
|
|
296
|
+
{
|
|
297
|
+
"type": "string",
|
|
298
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"not": {
|
|
302
|
+
"enum": [
|
|
303
|
+
"app",
|
|
304
|
+
"dependencies",
|
|
305
|
+
"tester",
|
|
306
|
+
"services",
|
|
307
|
+
"dev",
|
|
308
|
+
"prod",
|
|
309
|
+
"test",
|
|
310
|
+
"e2e"
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
]
|
|
163
315
|
}
|
|
164
316
|
},
|
|
165
317
|
"publish": {
|
|
@@ -170,6 +322,28 @@
|
|
|
170
322
|
}
|
|
171
323
|
},
|
|
172
324
|
"additionalProperties": false
|
|
325
|
+
},
|
|
326
|
+
"propertyNames": {
|
|
327
|
+
"allOf": [
|
|
328
|
+
{
|
|
329
|
+
"type": "string",
|
|
330
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"not": {
|
|
334
|
+
"enum": [
|
|
335
|
+
"app",
|
|
336
|
+
"dependencies",
|
|
337
|
+
"tester",
|
|
338
|
+
"services",
|
|
339
|
+
"dev",
|
|
340
|
+
"prod",
|
|
341
|
+
"test",
|
|
342
|
+
"e2e"
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
]
|
|
173
347
|
}
|
|
174
348
|
}
|
|
175
349
|
},
|
|
@@ -196,8 +370,26 @@
|
|
|
196
370
|
"dependencies": {
|
|
197
371
|
"type": "object",
|
|
198
372
|
"additionalProperties": {
|
|
199
|
-
"
|
|
200
|
-
|
|
373
|
+
"allOf": [
|
|
374
|
+
{
|
|
375
|
+
"type": "string",
|
|
376
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"not": {
|
|
380
|
+
"enum": [
|
|
381
|
+
"app",
|
|
382
|
+
"dependencies",
|
|
383
|
+
"tester",
|
|
384
|
+
"services",
|
|
385
|
+
"dev",
|
|
386
|
+
"prod",
|
|
387
|
+
"test",
|
|
388
|
+
"e2e"
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
]
|
|
201
393
|
},
|
|
202
394
|
"propertyNames": {
|
|
203
395
|
"pattern": "^[a-z][a-z0-9-]*$"
|
|
@@ -206,8 +398,26 @@
|
|
|
206
398
|
"dependsOn": {
|
|
207
399
|
"type": "array",
|
|
208
400
|
"items": {
|
|
209
|
-
"
|
|
210
|
-
|
|
401
|
+
"allOf": [
|
|
402
|
+
{
|
|
403
|
+
"type": "string",
|
|
404
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"not": {
|
|
408
|
+
"enum": [
|
|
409
|
+
"app",
|
|
410
|
+
"dependencies",
|
|
411
|
+
"tester",
|
|
412
|
+
"services",
|
|
413
|
+
"dev",
|
|
414
|
+
"prod",
|
|
415
|
+
"test",
|
|
416
|
+
"e2e"
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
]
|
|
211
421
|
}
|
|
212
422
|
},
|
|
213
423
|
"publish": {
|
|
@@ -218,6 +428,28 @@
|
|
|
218
428
|
}
|
|
219
429
|
},
|
|
220
430
|
"additionalProperties": false
|
|
431
|
+
},
|
|
432
|
+
"propertyNames": {
|
|
433
|
+
"allOf": [
|
|
434
|
+
{
|
|
435
|
+
"type": "string",
|
|
436
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"not": {
|
|
440
|
+
"enum": [
|
|
441
|
+
"app",
|
|
442
|
+
"dependencies",
|
|
443
|
+
"tester",
|
|
444
|
+
"services",
|
|
445
|
+
"dev",
|
|
446
|
+
"prod",
|
|
447
|
+
"test",
|
|
448
|
+
"e2e"
|
|
449
|
+
]
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
]
|
|
221
453
|
}
|
|
222
454
|
}
|
|
223
455
|
},
|
|
@@ -244,8 +476,26 @@
|
|
|
244
476
|
"dependencies": {
|
|
245
477
|
"type": "object",
|
|
246
478
|
"additionalProperties": {
|
|
247
|
-
"
|
|
248
|
-
|
|
479
|
+
"allOf": [
|
|
480
|
+
{
|
|
481
|
+
"type": "string",
|
|
482
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"not": {
|
|
486
|
+
"enum": [
|
|
487
|
+
"app",
|
|
488
|
+
"dependencies",
|
|
489
|
+
"tester",
|
|
490
|
+
"services",
|
|
491
|
+
"dev",
|
|
492
|
+
"prod",
|
|
493
|
+
"test",
|
|
494
|
+
"e2e"
|
|
495
|
+
]
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
]
|
|
249
499
|
},
|
|
250
500
|
"propertyNames": {
|
|
251
501
|
"pattern": "^[a-z][a-z0-9-]*$"
|
|
@@ -254,8 +504,26 @@
|
|
|
254
504
|
"dependsOn": {
|
|
255
505
|
"type": "array",
|
|
256
506
|
"items": {
|
|
257
|
-
"
|
|
258
|
-
|
|
507
|
+
"allOf": [
|
|
508
|
+
{
|
|
509
|
+
"type": "string",
|
|
510
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"not": {
|
|
514
|
+
"enum": [
|
|
515
|
+
"app",
|
|
516
|
+
"dependencies",
|
|
517
|
+
"tester",
|
|
518
|
+
"services",
|
|
519
|
+
"dev",
|
|
520
|
+
"prod",
|
|
521
|
+
"test",
|
|
522
|
+
"e2e"
|
|
523
|
+
]
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
]
|
|
259
527
|
}
|
|
260
528
|
},
|
|
261
529
|
"publish": {
|
|
@@ -266,6 +534,28 @@
|
|
|
266
534
|
}
|
|
267
535
|
},
|
|
268
536
|
"additionalProperties": false
|
|
537
|
+
},
|
|
538
|
+
"propertyNames": {
|
|
539
|
+
"allOf": [
|
|
540
|
+
{
|
|
541
|
+
"type": "string",
|
|
542
|
+
"pattern": "^[a-z][a-z0-9-]*$"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
"not": {
|
|
546
|
+
"enum": [
|
|
547
|
+
"app",
|
|
548
|
+
"dependencies",
|
|
549
|
+
"tester",
|
|
550
|
+
"services",
|
|
551
|
+
"dev",
|
|
552
|
+
"prod",
|
|
553
|
+
"test",
|
|
554
|
+
"e2e"
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
]
|
|
269
559
|
}
|
|
270
560
|
}
|
|
271
561
|
},
|
|
@@ -21,7 +21,10 @@ parent[a] := lower(input[i].Value[0]) if {
|
|
|
21
21
|
edges := {a: neighbors | some i; a := alias_at[i]; neighbors := [p | p := parent[a]]}
|
|
22
22
|
lineage[a] := graph.reachable(edges, {a}) | {a} if { some i; a := alias_at[i] }
|
|
23
23
|
commands[a] := {i | some i; stage_at[i] in lineage[a]; input[i].Cmd == "cmd"} if { some j; a := alias_at[j] }
|
|
24
|
-
|
|
24
|
+
healthcheck_indices[a] := {i | some i; stage_at[i] in lineage[a]; input[i].Cmd == "healthcheck"} if { some j; a := alias_at[j] }
|
|
25
|
+
effective_healthcheck_index[a] := max(indices) if { indices := healthcheck_indices[a]; count(indices) > 0 }
|
|
26
|
+
effective_healthcheck_value[a] := lower(concat(" ", input[index].Value)) if { index := effective_healthcheck_index[a] }
|
|
27
|
+
has_valid_effective_healthcheck(a) if { value := effective_healthcheck_value[a]; value != "none" }
|
|
25
28
|
artifact_copies[a] := {i | some i; stage_at[i] in lineage[a]; input[i].Cmd == "copy"; startswith(lower(input[i].Flags[_]), "--from=")} if { some j; a := alias_at[j] }
|
|
26
29
|
|
|
27
30
|
deny contains msg if {
|
|
@@ -31,8 +34,8 @@ deny contains msg if {
|
|
|
31
34
|
}
|
|
32
35
|
deny contains "Hardcoded EXPOSE is forbidden; Builder owns endpoint publication" if { some i; input[i].Cmd == "expose" }
|
|
33
36
|
deny contains "dev stage requires a default CMD" if { "dev" in stages; count(commands.dev) == 0 }
|
|
34
|
-
deny contains "dev stage requires a valid HEALTHCHECK" if { "dev" in stages;
|
|
35
|
-
deny contains "prod stage requires a valid HEALTHCHECK" if { "prod" in stages;
|
|
37
|
+
deny contains "dev stage requires a valid HEALTHCHECK" if { "dev" in stages; not has_valid_effective_healthcheck("dev") }
|
|
38
|
+
deny contains "prod stage requires a valid HEALTHCHECK" if { "prod" in stages; not has_valid_effective_healthcheck("prod") }
|
|
36
39
|
deny contains "prod stage requires COPY --from= artifact isolation" if { "prod" in stages; count(artifact_copies.prod) == 0 }
|
|
37
40
|
deny contains msg if {
|
|
38
41
|
some i
|
|
@@ -48,12 +51,6 @@ deny contains msg if {
|
|
|
48
51
|
regex.match("(^|[ ;])nohup[ ;]|&[[:space:]]*$|pm2[[:space:]]+start.*--daemon|nginx(.*[[:space:]])?-g[[:space:]]*['\"]?daemon[[:space:]]+on", command)
|
|
49
52
|
msg := sprintf("Runtime CMD must remain in foreground (instruction %v)", [i])
|
|
50
53
|
}
|
|
51
|
-
deny contains msg if {
|
|
52
|
-
some i
|
|
53
|
-
input[i].Cmd == "healthcheck"
|
|
54
|
-
lower(concat(" ", input[i].Value)) == "none"
|
|
55
|
-
msg := sprintf("HEALTHCHECK NONE is forbidden (instruction %v)", [i])
|
|
56
|
-
}
|
|
57
54
|
deny contains msg if {
|
|
58
55
|
some i
|
|
59
56
|
input[i].Cmd == "cmd"
|