Skip to content
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

Retrieve the latest ES version #34

Merged
merged 2 commits into from
Feb 3, 2025
Merged

Retrieve the latest ES version #34

merged 2 commits into from
Feb 3, 2025

Conversation

ezimuel
Copy link
Collaborator

@ezimuel ezimuel commented Jan 31, 2025

This PR adds the get_latest_version() function to retrieve the latest Elasticsearch version automatically.

Copy link

@acsnyder acsnyder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! At least on my Mac

Do you want to have a fallback in case the API response fails?

@xeraa
Copy link

xeraa commented Feb 1, 2025

I think the beta / RC releases of 9.0.0 will be picked up as the last version, which is probably not what we want?
I just pulled the JSON file and tried it with a slightly modified shell script.

#!/bin/bash

version_sort() {
    awk -F'.' '
    {
        printf("%d %d %d %s\n", $1, $2, $3, $0)
    }' | sort -n -k1,1 -k2,2 -k3,3 | awk '{print $4}'
}

awk -F'"' '/"version": *"/ {print $4}' stack.json | version_sort | tail -n 1

@ezimuel
Copy link
Collaborator Author

ezimuel commented Feb 3, 2025

@xeraa I think start-local should install only stable release by default. I'm working to add also a parameter to the script to choose a different version. Using this param folks can decide which version, including a beta if it's available on docker.elastic.co.

@xeraa
Copy link

xeraa commented Feb 3, 2025

Yes, I also think that start-local should only pick stable releases. But if https://artifacts.elastic.co/releases/stack.json adds the beta and RC releases for 9.0.0 (which I assume it will), this PR will pick them up as the latest / highest version.

@ezimuel
Copy link
Collaborator Author

ezimuel commented Feb 3, 2025

@acsnyder I think the https://artifacts.elastic.co/releases/stack.json should only show stable releases of Elasticsearch, right?

@xeraa
Copy link

xeraa commented Feb 3, 2025

The file already includes releases like 8.0.0-rc1 etc

@ezimuel
Copy link
Collaborator Author

ezimuel commented Feb 3, 2025

@xeraa I didn't notice it, thanks! In that case I think we should remove the x.y.z-* versions in the awk expression. I'll propose a change.

@ezimuel
Copy link
Collaborator Author

ezimuel commented Feb 3, 2025

@xeraa and @acsnyder I removed the beta and candidate releases and added also the GA versions (since 8.0.0 GA is a stable release but it needs to be converted in 8.0.0 removing the GA suffix). Moreover, I added the test for checking that the latest version is not empty and it's a valid major.minor.patch format.

@ezimuel ezimuel merged commit 54d78e7 into main Feb 3, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants