-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Add retry when retrieving agent version #186459
[Fleet] Add retry when retrieving agent version #186459
Conversation
Pinging @elastic/fleet (Team:Fleet) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
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 🚢 Thanks for fixing it!
|
||
export async function getLatestVersion(): Promise<string> { | ||
const response: any = await axios('https://artifacts-api.elastic.co/v1/versions'); | ||
return last(response.data.versions as string[]) || '8.1.0-SNAPSHOT'; | ||
return pRetry(() => axios('https://artifacts-api.elastic.co/v1/versions'), { |
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.
The artifacts-api is not stable, don't use it. We had to move away from it in the agent team.
The latest snapshot for each version is available from https://snapshots.elastic.co which does not use the artifacts API.
Examples:
- https://snapshots.elastic.co/latest/8.15.0-SNAPSHOT.json
- https://snapshots.elastic.co/latest/8.14.2-SNAPSHOT.json
The version to use will be the current version of Kibana in a branch for the next release.
Those will give you a build ID you can use to build the artifact download URL For example 8.15.0-SNAPSHOT gives you "build_id" : "8.15.0-72200925"
as the latest build ID which gets used as shown below to get the linux x64_64 .tar.gz artifact directly.
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.
@cmacknz Looks like a bunch of Kibana tests use the artifacts API, do you think even with retry? (and a fallback value) it's not good enough?
I am worried when using https://snapshots.elastic.co/
we will have issues when creating new branch for new version and when the elastic-agent SNAPSHOT is not yet available
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 am worried when using https://snapshots.elastic.co/ we will have issues when creating new branch for new version and when the elastic-agent SNAPSHOT is not yet available
Then we might have to pin the exact version indeed. Retrying might help but stability is not guaranteed.
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.
Then we might have to pin the exact version indeed. Retrying might help but stability is not guaranteed.
The way I implemented this is with retry and a fallback value to 8.15.0-SNAPSHOT
if retries failed
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.
You can certainly start with a retry and see how it works, if it continues to be flaky the solution is as described above - don't use the artifacts-api.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
To update your PR or re-run it, just comment with: cc @nchaulet |
Summary
Resolve #184681
The test to run standalone agents are sometime failing when retrieving the agent version for the artifacts API.
That PR should fix it, by adding retries and a fallback value.