-
Notifications
You must be signed in to change notification settings - Fork 86
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
Clear agent.upgrade_attempts on upgrade complete #4528
base: main
Are you sure you want to change the base?
Clear agent.upgrade_attempts on upgrade complete #4528
Conversation
This pull request does not have a backport label. Could you fix it @jillguyonnet? 🙏
|
@@ -219,7 +219,7 @@ func (ct *CheckinT) validateRequest(zlog zerolog.Logger, w http.ResponseWriter, | |||
} | |||
|
|||
wTime := pollDuration + time.Minute | |||
rc := http.NewResponseController(w) //nolint:bodyclose // we are working with a ResponseWriter not a Respons | |||
rc := http.NewResponseController(w) |
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.
This caused the nolintlint
linter to error:
Error: internal/pkg/api/handleCheckin.go:222:39: directive `//nolint:bodyclose // we are working with a ResponseWriter not a Respons` is unused for linter "bodyclose" (nolintlint)
I installed golangci-lint
(version 1.64.5) locally and removing this nolint
directive works, so that seemed like a better option than also silencing nolintlint
.
By the way, golangci-lint run
yields a lot of errors across the codebase, most of them errcheck
. It seems the CI only lints modified files.
|
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.
Code looks sensible, holding off the approval until we have a green CI run (it seems we are getting some errors from ECH when creating a stack and 503s when trying to clean it up (not sure if it's related to the failed creation)
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.
lgtm, merge when CI is green
There is a test you should update to check that this field is properly reset: fleet-server/internal/pkg/api/handleCheckin_test.go Lines 334 to 354 in ba68a24
|
What is the problem this PR solves?
elastic/kibana#212744 adds retry logic to the task that automatically ugprades agents. Agents that were upgraded through this task have their new
upgrade_attempts
property populated. It is missing a way to clear this property when the upgrade completes.How does this PR solve the problem?
The change in this PR clears
upgrade_attempts
when the upgrade is complete.How to test this PR locally
This should be tested alongside elastic/kibana#212744 (or after it is merged - this is fine, since automatic upgrades are currently behind the
enableAutomaticAgentUpgrades
feature flag). With this change, agents upgraded through the automatic upgrade task should have theirupgrade_attempts
property set tonull
.Design Checklist
Checklist
./changelog/fragments
using the changelog toolRelated issues
Relates https://github.com/elastic/ingest-dev/issues/4720