[Multi_K8s-Plugin] Extract duplicated target-building pattern into shared helpers#6782
Open
mohammedfirdouss wants to merge 2 commits into
Open
[Multi_K8s-Plugin] Extract duplicated target-building pattern into shared helpers#6782mohammedfirdouss wants to merge 2 commits into
mohammedfirdouss wants to merge 2 commits into
Conversation
7f38fd2 to
8aad3a7
Compare
8aad3a7 to
aef9158
Compare
… and errgroup pattern into shared helpers Signed-off-by: Mohammed Firdous <124298708+mohammedfirdouss@users.noreply.github.com>
aef9158 to
6d3dc39
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6782 +/- ##
==========================================
+ Coverage 29.33% 36.57% +7.24%
==========================================
Files 598 63 -535
Lines 63902 5889 -58013
==========================================
- Hits 18744 2154 -16590
+ Misses 43711 3622 -40089
+ Partials 1447 113 -1334
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
Extracts the repeated ~45-line target-resolution and errgroup pattern from the four stage entry-point functions (
executeK8sMultiSyncStage,executeK8sMultiCanaryRolloutStage,executeK8sMultiBaselineRolloutStage,executeK8sMultiPrimaryRolloutStage) into two package-level helpers in a new filedeployment/targets.go:buildStageTargets(lp, dts, multiTargets)resolves which deploy targets a stage should run on (all targets if multiTargets is empty, or the named subset)runOnTargets(ctx, lp, targets, fn)fans outfnacross targets in parallel via errgroupWhy we need it:
All four rollout/sync entry-point functions contained identical boilerplate: build a deploy-target map, resolve the target list, fan out with errgroup, handle errors. Any bug fix or behaviour change had to be applied in four places. The helpers eliminate the duplication while keeping behaviour identical.
Which issue(s) this PR fixes:
Fixes #6446
Does this PR introduce a user-facing change?: