Cherry-pick #19102 to 7.x: Retryable downloads of beats #19156
Merged
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.
Cherry-pick of PR #19102 to 7.x branch. Original message:
What does this PR do?
Background:
when agent downloads an artifact and checksum does not match it yields a failure, but then it might occur that when download is performed again due to new config or whatever, download is skipped (because download was successful for some reason or packed artifacts are invalid).
Agent cleans up downloaded artifact only in case download yields error. so if this does not yield error but artifact is corrupted we might end up in a loop because it will try to verify artifact it find out it's incorrect and continues with failure... and so on
This PR changes this behavior a bit.
In case Verify fails. it cleans up downloaded artifacts (artifact + hash).
It also introduces retryable block within operation flow.
In this case we know than=t download+verify might be error prone so we can retry them if failure happens. (only if retry.enabled == true)
What this means for agent is that when it tries to install from corrupted artifact, it will remove artifact during Verify and re-download it again.
Why is it important?
Make download scneario more robust and repair loop faster
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test
retry.enabled: true
See it fails with packed artifact, waits 30s and then downloads artifact from web