Skip to content

[AFE-46] use Astronomer releases endpoint for version checking#2027

Merged
nickypy merged 4 commits intomainfrom
nick3/update-version-checking
Mar 5, 2026
Merged

[AFE-46] use Astronomer releases endpoint for version checking#2027
nickypy merged 4 commits intomainfrom
nick3/update-version-checking

Conversation

@nickypy
Copy link
Contributor

@nickypy nickypy commented Mar 3, 2026

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

VERSION=1.38 make build
./astro version

📸 Screenshots

Add screenshots to illustrate the validity of these changes.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

@nickypy nickypy changed the title AFE-46 use Astronomer releases endpoint for version checking [AFE-46] use Astronomer releases endpoint for version checking Mar 3, 2026
@nickypy nickypy requested a review from a team March 3, 2026 22:21
@coveralls-official
Copy link

coveralls-official bot commented Mar 3, 2026

Pull Request Test Coverage Report for Build e9d65a62-3f0e-4a09-b567-57ec4e1d587e

Details

  • 31 of 40 (77.5%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 35.942%

Changes Missing Coverage Covered Lines Changed/Added Lines %
version/version.go 27 36 75.0%
Files with Coverage Reduction New Missed Lines %
version/version.go 1 53.23%
Totals Coverage Status
Change from base Build 408796d1-867a-49d6-a9f1-470124cda0c8: 0.03%
Covered Lines: 24314
Relevant Lines: 67648

💛 - Coveralls

@nickypy nickypy requested a review from neel-astro March 3, 2026 22:38
@nickypy nickypy marked this pull request as ready for review March 3, 2026 22:38
@nickypy nickypy requested a review from a team as a code owner March 3, 2026 22:38
@nickypy nickypy force-pushed the nick3/update-version-checking branch from 80d7e31 to e8ec9f5 Compare March 4, 2026 16:46
@nickypy nickypy force-pushed the nick3/update-version-checking branch from e8ec9f5 to 1b79804 Compare March 4, 2026 22:18
Copy link
Contributor

@neel-astro neel-astro left a comment

Choose a reason for hiding this comment

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

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for fixing the doc link

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)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed :)

@nickypy nickypy requested a review from neel-astro March 5, 2026 15:41
@nickypy nickypy merged commit 35e7599 into main Mar 5, 2026
6 checks passed
@nickypy nickypy deleted the nick3/update-version-checking branch March 5, 2026 15:50
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.

Improve the upgrade messaging for new releases

2 participants