[Fleet] Always use a SNAPSHOT version when running elastic-agent docker image (#187777)

This commit is contained in:
Nicolas Chaulet 2024-07-09 07:27:20 -04:00 committed by GitHub
parent 692b656f9c
commit 834f8fdb37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,6 +15,10 @@ export async function getLatestVersion(): Promise<string> {
return pRetry(() => axios('https://artifacts-api.elastic.co/v1/versions'), {
maxRetryTime: 60 * 1000, // 1 minute
})
.then((response) => last(response.data.versions as string[]) || DEFAULT_VERSION)
.then(
(response) =>
last((response.data.versions as string[]).filter((v) => v.includes('-SNAPSHOT'))) ||
DEFAULT_VERSION
)
.catch(() => DEFAULT_VERSION);
}