-
Notifications
You must be signed in to change notification settings - Fork 153
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
Log warning on same version upgrade to prevent failed status #6273
Changes from 3 commits
29ea961
96deaee
299ab0b
1abfd1f
6cac6df
ea65977
5688de5
1ea127e
72a5106
14e7875
4ba234c
b467845
29ba576
167701b
eff680d
bef8ff6
0232a31
aeb6ee0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,7 +172,7 @@ func (u *Upgrader) Upgrade(ctx context.Context, version string, sourceURI string | |
// check version before download | ||
same, _ := isSameVersion(u.log, currentVersion, packageMetadata{}, version) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check will not work for snapshot upgrades. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but it should work for non-snapshot attempts, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pchila so in this case this will fail because hash is unpopulated right? but then later it is extracted and checked again on line 224. so we lose a bit of time but will not perform upgrade There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we are relying on the fact that the current version has a not empty hash compared to the zero value in I guess we will never get true from here... Did you test this ? Is there a case where this returns true ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you're correct, I forgot that comparing currentVersion vs version would also compare the hashes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added a new func that does this comparison correctly. |
||
if same { | ||
u.log.Warnf("Upgrade action skipped: %v", ErrUpgradeSameVersion) | ||
u.log.Warnf("Upgrade action skipped because agent is already at version %s", currentVersion) | ||
return nil, ErrUpgradeSameVersion | ||
} | ||
|
||
|
@@ -223,7 +223,7 @@ func (u *Upgrader) Upgrade(ctx context.Context, version string, sourceURI string | |
// Recheck version here in case of a snapshot->snapshot upgrade on the same version. | ||
same, newVersion := isSameVersion(u.log, currentVersion, metadata, version) | ||
if same { | ||
u.log.Warnf("Upgrade action skipped: %v", ErrUpgradeSameVersion) | ||
u.log.Warnf("Upgrade action skipped because agent is already at version %s", currentVersion) | ||
return nil, ErrUpgradeSameVersion | ||
} | ||
|
||
|
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.
I don't think we want to consider this an error, that is what lead to the bug this is fixing in the first place. It needs to be like an idempotent API call. It returns success if the action has already completed successfully once.