Refactor upgrade logic to skip pre upgrade job in case of patch revisions#138
Refactor upgrade logic to skip pre upgrade job in case of patch revisions#138anshumanks merged 9 commits intodevelopfrom
Conversation
controllers/version_update.go
Outdated
| log.Printf("Version update: patch revision detected, skipping pre-upgrade and post-upgrade jobs.") | ||
| // Mark pre and post upgrade jobs as succeeded so they don't get triggered when reconciling | ||
| // patchRevision will become false after reconciliation | ||
| setCondition(master, updateStatus.PreUpgradeSucceeded) |
There was a problem hiding this comment.
No need to mark them as succeeded if you haven't run it.
In case of patch revision, the logic would probably the same as in the case of versionComparison == 0.
There was a problem hiding this comment.
That was the initial plan, but if I add something like if !isConditionTrue(master, updateStatus.Pre/PostUpgradeSucceeded) && !skipPreUpgrade, this will skip pre upgrade, and change the image. Then versionComparison will become 0.
If we incorporate 0 along with -4 in skipPreUpgrade ( versionComparison == -4 || versionComparison == 0 ), for minor/major changes the post upgrade job will get skipped.
Possible fix: Skip pre upgrade in case of 0 and -4, and modify post upgrade condition as
!isConditionTrue(master, updateStatus.PostUpgradeSucceeded) && isConditionTrue(master, updateStatus.PreUpgradeSucceeded)
controllers/version_update.go
Outdated
| case -1: | ||
| // Upgrade case | ||
|
|
||
| if versionComparison < 0 { // Upgrade case |
There was a problem hiding this comment.
nit: please add comments above the code instead of inline. Comment sentences should end with a period (.)
Fix t/o
Refactor upgrade logic to skip pre upgrade job in case of patch revisions
Description
This change prevents pre upgrade job from stopping pipelines in case of patch revisions.
Code change
version_update.go, constants.goUnit Tests
version_update_test.goTested
In case of patch revisions:

Patch revision with skip pre upgrade flag = false:


In other cases:
