Commit 23996e8
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 f631cd9 commit 23996e8
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 | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
304 | 307 | | |
| 308 | + | |
305 | 309 | | |
306 | 310 | | |
307 | 311 | | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
312 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
313 | 319 | | |
314 | 320 | | |
315 | 321 | | |
316 | 322 | | |
317 | 323 | | |
318 | 324 | | |
319 | 325 | | |
320 | | - | |
| 326 | + | |
| 327 | + | |
321 | 328 | | |
322 | 329 | | |
323 | | - | |
324 | | - | |
| 330 | + | |
| 331 | + | |
325 | 332 | | |
326 | 333 | | |
327 | 334 | | |
| |||
349 | 356 | | |
350 | 357 | | |
351 | 358 | | |
352 | | - | |
353 | | - | |
| 359 | + | |
| 360 | + | |
354 | 361 | | |
355 | 362 | | |
356 | | - | |
| 363 | + | |
357 | 364 | | |
358 | | - | |
| 365 | + | |
359 | 366 | | |
360 | | - | |
| 367 | + | |
361 | 368 | | |
362 | 369 | | |
363 | 370 | | |
| |||
0 commit comments