Commit 52e62b5
feat(ci): parallelize base and RBAC helm deployments (#4679)
* feat(ci): parallelize base and RBAC helm deployments
Run base_deployment and rbac_deployment concurrently in initiate_deployments()
and initiate_deployments_osd_gcp(). Both target disjoint namespaces (NAME_SPACE
vs NAME_SPACE_RBAC + NAME_SPACE_POSTGRES_DB), so there is no resource conflict.
Overlapping the two helm upgrades and their internal readiness waits saves
~3-5 min of wall-clock time on CI.
The _run_parallel_deployments helper captures each background job's exit code
via `wait "$pid" || rc=$?` and returns 1 if either fails, so failures always
propagate and are individually reported in the logs. Tests continue to run
sequentially downstream (parallel Playwright would OOM given CI memory limits).
Resolves: RHIDP-12296
* refactor(ci): add defensive checks and improved logging to parallel deployments
Address code review findings from PR #4679:
1. **Namespace validation**: Add defensive check to ensure NAME_SPACE and
NAME_SPACE_RBAC are different and non-empty before starting parallel
deployments. Prevents subtle race conditions if misconfigured.
2. **Improved logging**:
- Log both namespace names at the start for debugging
- Add synchronization point logs ("Waiting for parallel deployments..."
and "Parallel deployments finished") to make log flow clearer when
output from both background jobs is interleaved
3. **Documentation**: Add "Requires" section to function header documenting
the namespace disjointness requirement
These changes improve debuggability and fail-fast behavior without changing
the core parallelization logic.
* 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 calls
* fix(ci): address code review findings for parallel deployments
1. postgres-cred.yaml in-place edit race: configure_external_postgres_db
now patches a temp copy instead of editing the shared template via
sed_inplace. Same class of bug fixed in apply_yaml_files.
2. Unquoted ${NAME_SPACE} in namespace::configure calls: quote both
occurrences (lines 553, 721) to prevent word-splitting.
3. mktemp in helm::merge_values overwrite path: move mktemp + trap
inside the "merge" branch so the "overwrite" path doesn't create
and immediately discard two unused temp files.
4. Remove redundant "Waiting for parallel deployments" log::section
that fires right before the blocking wait calls — the bookend
sections are sufficient.
* fix(ci): replace trap RETURN with explicit cleanup
trap RETURN leaks to the calling function in bash < 4.4, causing
unbound variable errors when step_1_file/tmpdir are expanded in
the caller's scope under set -o nounset.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 1b57c01 commit 52e62b5
3 files changed
Lines changed: 98 additions & 23 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 | | |
| |||
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
| 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 | + | |
325 | 327 | | |
| 328 | + | |
326 | 329 | | |
327 | 330 | | |
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
331 | 334 | | |
332 | 335 | | |
333 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
334 | 339 | | |
335 | 340 | | |
336 | 341 | | |
337 | 342 | | |
338 | 343 | | |
339 | 344 | | |
340 | 345 | | |
341 | | - | |
| 346 | + | |
| 347 | + | |
342 | 348 | | |
343 | 349 | | |
344 | | - | |
345 | | - | |
| 350 | + | |
| 351 | + | |
346 | 352 | | |
347 | 353 | | |
348 | 354 | | |
| |||
370 | 376 | | |
371 | 377 | | |
372 | 378 | | |
373 | | - | |
374 | | - | |
| 379 | + | |
| 380 | + | |
375 | 381 | | |
376 | 382 | | |
377 | | - | |
| 383 | + | |
378 | 384 | | |
379 | | - | |
| 385 | + | |
380 | 386 | | |
381 | | - | |
| 387 | + | |
382 | 388 | | |
383 | 389 | | |
384 | 390 | | |
385 | 391 | | |
| 392 | + | |
| 393 | + | |
386 | 394 | | |
387 | 395 | | |
388 | 396 | | |
| |||
564 | 572 | | |
565 | 573 | | |
566 | 574 | | |
567 | | - | |
| 575 | + | |
568 | 576 | | |
569 | 577 | | |
570 | 578 | | |
| |||
654 | 662 | | |
655 | 663 | | |
656 | 664 | | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
657 | 727 | | |
658 | 728 | | |
659 | 729 | | |
660 | 730 | | |
661 | 731 | | |
662 | | - | |
663 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
664 | 735 | | |
665 | 736 | | |
666 | 737 | | |
667 | 738 | | |
668 | 739 | | |
669 | 740 | | |
670 | 741 | | |
671 | | - | |
| 742 | + | |
672 | 743 | | |
673 | 744 | | |
674 | 745 | | |
| |||
727 | 798 | | |
728 | 799 | | |
729 | 800 | | |
730 | | - | |
731 | | - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
732 | 804 | | |
733 | 805 | | |
734 | 806 | | |
| |||
0 commit comments