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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Houston version check on upgrade #353

Merged
merged 5 commits into from
Aug 13, 2020
Merged

Conversation

adam2k
Copy link
Contributor

@adam2k adam2k commented Aug 7, 2020

Description

astro upgrade should not require Houston context.

馃師 Issue(s)

Resolves astronomer/issues#1606

馃И Functional Testing

  1. You can test locally by build a local version that is the same as the latest:

Without authentication to a server:

$ ./astro upgrade
Astro CLI Version: v0.17.0 (2020.07.24)
Astro CLI Latest: v0.17.0  (2020.07.24)
Astro Server Version: Please authenticate to a cluster to see server version
You are running the latest version.

With server authentication:

./astro upgrade
Astro CLI Version: v0.17.0 (2020.07.24)
Astro CLI Latest: v0.17.0  (2020.07.24)
Astro Server Version: 0.18.0
You are running the latest version.
  1. You can test locally by building a local version that using an outdated CurrVersion:

Without server authentication:

$ rm -rf ~/.astro
$ go build -o astro -ldflags "-X github.com/astronomer/astro-cli/version.CurrVersion=0.15.0  -X github.com/astronomer/astro-cli/version.CurrCommit=5ae31076d9f2dfc874c533e6c729e1fa7681b7f4" main.go
$./astro upgrade
Astro CLI Version: v0.15.0 (2020.06.01)
Astro CLI Latest: v0.17.0  (2020.07.24)
Astro Server Version: Please authenticate to a cluster to see server version
A newer version of the Astronomer CLI is available.
To upgrade to latest, run:
	$ curl -sL https://install.astronomer.io | sudo bash
OR for homebrew users:
	$ brew install astronomer/tap/astro

With server authentication:

$ ./astro upgrade
Astro CLI Version: v0.15.0 (2020.06.01)
Astro CLI Latest: v0.17.0  (2020.07.24)
Astro Server Version: 0.18.0
A newer version of the Astronomer CLI is available.
To upgrade to latest, run:
	$ curl -sL https://install.astronomer.io | sudo bash
OR for homebrew users:
	$ brew install astronomer/tap/astro

馃搵 Checklist

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

@adam2k adam2k requested a review from paolaperaza August 7, 2020 20:36
@adam2k adam2k self-assigned this Aug 7, 2020
@codecov
Copy link

codecov bot commented Aug 7, 2020

Codecov Report

Merging #353 into main will increase coverage by 8.65%.
The diff coverage is 63.79%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #353      +/-   ##
==========================================
+ Coverage   43.40%   52.06%   +8.65%     
==========================================
  Files          24       31       +7     
  Lines        1744     2328     +584     
==========================================
+ Hits          757     1212     +455     
- Misses        957     1038      +81     
- Partials       30       78      +48     
Impacted Files Coverage 螖
airflow/airflow.go 62.16% <0.00%> (+62.16%) 猬嗭笍
cmd/auth.go 44.68% <0.00%> (-6.39%) 猬囷笍
cmd/cluster.go 69.23% <0.00%> (-6.45%) 猬囷笍
cmd/deployment.go 68.82% <0.00%> (-4.19%) 猬囷笍
cmd/workspace.go 66.53% <0.00%> (+2.67%) 猬嗭笍
config/config.go 47.05% <酶> (酶)
cmd/version.go 62.16% <36.36%> (-4.51%) 猬囷笍
workspace/workspace.go 74.57% <50.00%> (酶)
config/context.go 26.08% <60.00%> (酶)
deployment/deployment.go 87.00% <95.23%> (酶)
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 965844e...8d3c9af. Read the comment docs.

@adam2k adam2k marked this pull request as ready for review August 7, 2020 20:37
@adam2k
Copy link
Contributor Author

adam2k commented Aug 7, 2020

@paolaperaza can you give feedback on the upgrade message changes here?

@andriisoldatenko
Copy link
Contributor

andriisoldatenko commented Aug 7, 2020

Coverage 43.40% 51.89% +8.48%

looks strange to me.

@adam2k
Copy link
Contributor Author

adam2k commented Aug 7, 2020

Coverage 43.40% 51.89% +8.48%

looks strange to me.

I think it's a codecov error. I can rerun the tests and see if that resolves the difference.

Screen Shot 2020-08-07 at 4 53 45 PM

@paolaperaza
Copy link
Contributor

@adam2k Thanks for doing this! A few general comments:

  • UX looks good for users not authenticated to Astronomer
  • Should we list Server version in the way astro version also does? Seems like that'd be more consistent, enforce the 1:1 platform <> CLI minor version compatibility for users to see/be reminded of.
  • I wonder if we can push people to authenticate if they run this command but aren't... i.e.I'm thinking about a user that forgets to login, run astro uprade, updates to latest, then it turns out they're on an earlier platform version and get an error message about compatibility and have to downgrade. Including Server Version and a reminder to authenticate if that's not available might be enough?

In terms of copy, could simplify message to:

To upgrade to latest, run:... and then keep OR for homebrew users... What do you think?

@adam2k
Copy link
Contributor Author

adam2k commented Aug 10, 2020

@adam2k Thanks for doing this! A few general comments:

* UX looks good for users not authenticated to Astronomer

* Should we list `Server version` in the way `astro version` also does? Seems like that'd be more consistent, enforce the 1:1 platform <> CLI minor version compatibility for users to see/be reminded of.

* I wonder if we can push people to authenticate if they run this command but aren't... i.e.I'm thinking about a user that forgets to login, run astro uprade, updates to latest, then it turns out they're on an earlier platform version and get an error message about compatibility and have to downgrade. Including `Server Version` and a reminder to authenticate if that's not available might be enough?

In terms of copy, could simplify message to:

To upgrade to latest, run:... and then keep OR for homebrew users... What do you think?

Thanks @paolaperaza! Yes, we can add in the server version here too. Do you think if we show the server version OR give the warning that they're not authenticated with a server, that would mitigate the last issue that you're describing enough? We might need to think about that experience some more and create a follow up issue because it might increase the scope of this issue a lot.

In the short term, do you think having some warning message like Upgrading beyond your server version may cause issues would be enough?

@adam2k
Copy link
Contributor Author

adam2k commented Aug 10, 2020

@paolaperaza so this issue doesn't get lost. We discussed making some of the additional changes outside of the message change inside of this issue: https://github.com/astronomer/issues/issues/1636

@paolaperaza
Copy link
Contributor

@adam2k Cool, commit looks good. Yea, I think if we list Server Version and whatever message is already there as-is that tells users to authenticate if they haven't already is enough to cover that problem/use case - definitely at least for now.

We can continue convo on the rest in astronomer/issues#1636!

"io"

"github.com/pkg/errors"
Copy link
Contributor

Choose a reason for hiding this comment

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

pls undo this change, bad formating:
must be
STD lib
3rd party
custom pkgs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, weird. My editor auto organized those. It looks like it's alphabetical from github. I'll try to revert.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what happened. I removed the empty space between "github.com/pkg/errors" and the astro imports and it grouped them altogether.


return nil
}

// CheckForUpdate checks current version against latest on github
func CheckForUpdate(client *github.Client, out io.Writer) error {
func CheckForUpdate(client *houston.Client, ghClient *github.Client, out io.Writer) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

JFYI for go code styling absolutely normal to rename ghClient to ghc.

@@ -91,3 +84,17 @@ func isValidVersion(version string) bool {
}
return true
}

// printServerVersion outputs current server version
func printServerVersion(client *houston.Client, out io.Writer) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to copy this?
DRY? for

appCfg, err := deployment.AppConfig(client)
if err != nil {
fmt.Fprintf(out, messages.HOUSTON_CURRENT_VERSION+"\n", "Please authenticate to a cluster to see server version")
}
if appCfg != nil {
fmt.Fprintf(out, messages.HOUSTON_CURRENT_VERSION+"\n", appCfg.Version)
}

Copy link
Contributor Author

@adam2k adam2k Aug 11, 2020

Choose a reason for hiding this comment

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

Yeah, I was trying to keep it DRY. This method is now being invoked twice. Once on line 33 and once on 70.

version/version.go Outdated Show resolved Hide resolved
Co-authored-by: Andrii Soldatenko <andrii.soldatenko@gmail.com>
@adam2k
Copy link
Contributor Author

adam2k commented Aug 12, 2020

@andriisoldatenko do these updates look good to you now?

@adam2k adam2k merged commit 8c8baec into main Aug 13, 2020
@adam2k adam2k deleted the fix/upgrade-version-check branch August 13, 2020 18:32
@adam2k
Copy link
Contributor Author

adam2k commented Aug 25, 2020

I validated this on dev. The versions look off because it's expecting 0.19.0 to be the latest tag in GH (right now it's still 0.18.0). As soon as we take 0.19.0 out of prerelease this will all look correct.

Testing on dev cluster:

$ astro upgrade
A new minor version of Astro CLI is available. Your version is 0.18.0 and 0.19.0 is the latest.
See https://www.astronomer.io/docs/cli-quickstart for more information.
Astro CLI Version: v0.18.0 (2020.08.07)
Astro CLI Latest: v0.18.0  (2020.08.07)
You are running the latest version.

adam2k pushed a commit that referenced this pull request Sep 2, 2020
* Remove Houston version check on upgrade

* Update message copy

* Print server version for upgrade

* Print the server version during upgrade

* Apply suggestions from code review

Co-authored-by: Andrii Soldatenko <andrii.soldatenko@gmail.com>

Co-authored-by: Andrii Soldatenko <andrii.soldatenko@gmail.com>
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.

None yet

4 participants