[AFE-46] use Astronomer releases endpoint for version checking#2027
Merged
[AFE-46] use Astronomer releases endpoint for version checking#2027
Conversation
Pull Request Test Coverage Report for Build e9d65a62-3f0e-4a09-b567-57ec4e1d587eDetails
💛 - Coveralls |
80d7e31 to
e8ec9f5
Compare
e8ec9f5 to
1b79804
Compare
neel-astro
approved these changes
Mar 5, 2026
Contributor
neel-astro
left a comment
There was a problem hiding this comment.
LGTM 🚀 , left a tiny nit if you want make that change.
| // Compare the versions and print a message to the user if the current version is outdated | ||
| if currentSemver.LessThan(latestSemver) { | ||
| fmt.Fprintf(os.Stderr, "\nA newer version of Astro CLI is available: %s\nPlease see https://www.astronomer.io/docs/astro/cli/install-cli#upgrade-the-astro-cli for information on how to update the Astro CLI\n\n", latestSemver) | ||
| fmt.Fprintf(os.Stderr, "\nA newer version of Astro CLI is available: %s\nPlease see https://www.astronomer.io/docs/astro/cli/upgrade-cli for information on how to update the Astro CLI\n\n", latestSemver) |
Contributor
There was a problem hiding this comment.
Thank you for fixing the doc link
version/version.go
Outdated
Comment on lines
+76
to
+90
| for _, r := range releases.AvailableReleases { | ||
| // discard any versions that we cannot parse | ||
| version, err := semver.NewVersion(r.Version) | ||
| if err == nil { | ||
| validVersions = append(validVersions, version) | ||
| } | ||
| } | ||
|
|
||
| if len(validVersions) == 0 { | ||
| return nil, errors.New("astro-cli releases endpoint returned 0 valid versions") | ||
| } | ||
|
|
||
| latestRelease := slices.MaxFunc(validVersions, func(a, b *semver.Version) int { | ||
| return a.Compare(b) | ||
| }) |
Contributor
There was a problem hiding this comment.
Suggested change
| for _, r := range releases.AvailableReleases { | |
| // discard any versions that we cannot parse | |
| version, err := semver.NewVersion(r.Version) | |
| if err == nil { | |
| validVersions = append(validVersions, version) | |
| } | |
| } | |
| if len(validVersions) == 0 { | |
| return nil, errors.New("astro-cli releases endpoint returned 0 valid versions") | |
| } | |
| latestRelease := slices.MaxFunc(validVersions, func(a, b *semver.Version) int { | |
| return a.Compare(b) | |
| }) | |
| var latest *semver.Version | |
| for _, r := range releases.AvailableReleases { | |
| v, err := semver.NewVersion(r.Version) | |
| if err == nil && (latest == nil || v.GreaterThan(latest)) { | |
| latest = v | |
| } | |
| } | |
| if latest == nil { | |
| return nil, errors.New("astro-cli releases endpoint returned 0 valid versions") | |
| } |
tiny nit: could probably save the extra loop over the slice
neel-astro
approved these changes
Mar 5, 2026
schnie
pushed a commit
that referenced
this pull request
Mar 5, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR replaces the GitHub release check to use https://updates.astronomer.io/astro-cli instead. This matches the behavior in Astro UI and takes into account the delay between release in this repo vs Homebrew.
🎟 Issue(s)
Fixes #1977
🧪 Functional Testing
📸 Screenshots
📋 Checklist
make testbefore taking out of draftmake lintbefore taking out of draft