-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor upgrade logic to skip pre upgrade job in case of patch revisions #138
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.go
Unit Tests
version_update_test.go
Tested
In case of patch revisions:

Patch revision with skip pre upgrade flag = false:


In other cases:
