-
Notifications
You must be signed in to change notification settings - Fork 148
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
snapshot/downloader: fix fetching snapshot URI #1791
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When parsing the response from the artifacts-api to get the latest snapshot (https://artifacts-api.elastic.co/v1/search/%s-SNAPSHOT/elastic-agent) it could happen that an entry that is not from the Elastic-Agent (like the Elastic-Agent-Shipper) would be evaluated and it would cause the `snapshotURI` function return an error. This commit fixes it by iterating the whole map before returning an error.
belimawr
added
Team:Elastic-Agent-Data-Plane
Label for the Agent Data Plane team
backport-v8.6.0
Automated backport with mergify
labels
Nov 24, 2022
belimawr
requested review from
AndersonQ and
michalpristas
and removed request for
a team
November 24, 2022 18:44
🌐 Coverage report
|
cmacknz
reviewed
Nov 24, 2022
internal/pkg/agent/application/upgrade/artifact/download/snapshot/downloader.go
Show resolved
Hide resolved
AndersonQ
approved these changes
Nov 25, 2022
internal/pkg/agent/application/upgrade/artifact/download/snapshot/downloader.go
Show resolved
Hide resolved
cmacknz
approved these changes
Nov 30, 2022
AndersonQ
approved these changes
Nov 30, 2022
@belimawr let's get this merged so it can be included in the next 8.6 build candidate |
mergify bot
pushed a commit
that referenced
this pull request
Dec 5, 2022
When parsing the response from the artifacts-api to get the latest snapshot (https://artifacts-api.elastic.co/v1/search/%s-SNAPSHOT/elastic-agent) it could happen that an entry that is not from the Elastic-Agent (like the Elastic-Agent-Shipper) would be evaluated and it would cause the `snapshotURI` function return an error. This commit fixes it by iterating the whole map before returning an error. (cherry picked from commit 8c034dd)
cmacknz
pushed a commit
that referenced
this pull request
Dec 6, 2022
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport-v8.6.0
Automated backport with mergify
Team:Elastic-Agent-Data-Plane
Label for the Agent Data Plane team
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.
What does this PR do?
When parsing the response from the artifacts-api to get the latest snapshot (https://artifacts-api.elastic.co/v1/search/%s-SNAPSHOT/elastic-agent) it could happen that an entry that is not from the Elastic-Agent (like the Elastic-Agent-Shipper) would be evaluated and it would cause the
snapshotURI
function return an error.This PR fixes it by iterating the whole map before returning an error.
Why is it important?
It fixes a bug
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature works- [ ] I have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.## Author's ChecklistHow to test this PR locally
Manual testing
8.6
branch (it will build the version8.6.0
)main
branch withSNAPSHOT=true
(it will build the version8.7.0-SNAPSHOT
)v8.6.0
elastic-agent.yml
and add thedropPath
settings:The caveat here is that because the bug depends on the order the API response is iterated on, sometimes it just works.
Automated version
The same problem as testing manually, it depends on the order of iteration on the map, so it was an intermittent bug.
## Related issues## Use cases## Screenshots## Logs