Commit fb6b330
committed
fix(ci): eliminate race conditions for parallel deployments
Address 3 critical race conditions identified by Qodo code review:
**1. Shared temp files in helm::merge_values (Bug #1)**
- BEFORE: Used fixed paths /tmp/step-without-plugins.yaml and
/tmp/step-only-plugins.yaml
- AFTER: Generate unique temp files per invocation via mktemp
- WHY: Concurrent helm::merge_values calls would overwrite each other's
intermediate files, corrupting merged values
**2. Kubeconfig global state mutation (Bug #2)**
- BEFORE: namespace::configure and apply_yaml_files both ran
`oc config set-context --current --namespace=...`
- AFTER: Removed all oc config set-context calls; added explicit
--namespace flag to all oc/kubectl apply commands that lacked it
- WHY: Parallel deployments racing on current context would apply
resources to nondeterministic namespaces
**3. In-place YAML file edits (Bug #3)**
- BEFORE: apply_yaml_files used sed -i to modify shared YAML templates
directly in the repo
- AFTER: Copy templates to per-deployment tmpdir, patch copies, apply
from tmpdir
- WHY: Concurrent sed -i edits would clobber each other and apply
manifests with wrong namespace fields
All three bugs would have caused nondeterministic deployment failures
when base_deployment and rbac_deployment run in parallel.
Changes:
- .ci/pipelines/lib/helm.sh: mktemp + trap cleanup for intermediate files
- .ci/pipelines/lib/namespace.sh: Remove oc config set-context
- .ci/pipelines/utils.sh: Tmpdir for YAML patches, explicit --namespace
on all oc apply calls1 parent a83006b commit fb6b330
3 files changed
Lines changed: 27 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| |||
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
325 | 328 | | |
| 329 | + | |
326 | 330 | | |
327 | 331 | | |
328 | 332 | | |
329 | 333 | | |
330 | 334 | | |
331 | 335 | | |
332 | 336 | | |
333 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
334 | 340 | | |
335 | 341 | | |
336 | 342 | | |
337 | 343 | | |
338 | 344 | | |
339 | 345 | | |
340 | 346 | | |
341 | | - | |
| 347 | + | |
| 348 | + | |
342 | 349 | | |
343 | 350 | | |
344 | | - | |
345 | | - | |
| 351 | + | |
| 352 | + | |
346 | 353 | | |
347 | 354 | | |
348 | 355 | | |
| |||
370 | 377 | | |
371 | 378 | | |
372 | 379 | | |
373 | | - | |
374 | | - | |
| 380 | + | |
| 381 | + | |
375 | 382 | | |
376 | 383 | | |
377 | | - | |
| 384 | + | |
378 | 385 | | |
379 | | - | |
| 386 | + | |
380 | 387 | | |
381 | | - | |
| 388 | + | |
382 | 389 | | |
383 | 390 | | |
384 | 391 | | |
| |||
0 commit comments