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

Add new CLI auth flow w/ tests and docs #1431

Merged
merged 12 commits into from
Aug 30, 2019
Merged

Add new CLI auth flow w/ tests and docs #1431

merged 12 commits into from
Aug 30, 2019

Conversation

joshmeek
Copy link

@joshmeek joshmeek commented Aug 30, 2019

Thanks for contributing to Prefect!

Please describe your work and make sure your PR:

  • adds new tests (if appropriate)
  • updates CHANGELOG.md (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

Note that your PR will not be reviewed unless all three boxes are checked.

What does this PR change?

Closes #1417
Adds new CLI commands for working with Prefect Cloud auth
Related to changes in #1423

e.g.

        $ prefect auth login --token MY_TOKEN
        Log in successful

        $ prefect auth list-tenants
        NAME                        SLUG                        ID
        Test Person                 test-person                 816sghf2-4d51-4338-a333-1771gns7614d
        test@prefect.io's Account   test-prefect-io-s-account   1971hs9f-e8ha-4a33-8c33-64512gds86g1 

        $ prefect auth switch-tenants --slug test-person
        Tenant switched

        $ prefect auth list-tenants
        NAME                        SLUG                        ID
        Test Person                 test-person                 816sghf2-4d51-4338-a333-1771gns7614d    *
        test@prefect.io's Account   test-prefect-io-s-account   1971hs9f-e8ha-4a33-8c33-64512gds86g1 

        $ prefect auth logout
        Logged out from tenant 

        $ prefect auth list-tenants
        NAME                        SLUG                        ID
        Test Person                 test-person                 816sghf2-4d51-4338-a333-1771gns7614d
        test@prefect.io's Account   test-prefect-io-s-account   1971hs9f-e8ha-4a33-8c33-64512gds86g1 

Depends on #1426

Why is this PR important?

Makes auth really easy to work with in the CLI

@joshmeek joshmeek added the component:cli Related to the Prefect CLI label Aug 30, 2019
@codecov
Copy link

codecov bot commented Aug 30, 2019

Codecov Report

Merging #1431 into master will increase coverage by 0.03%.
The diff coverage is 95.94%.

Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

Minor nits and picks - this looks super useful

docs/cloud/cloud_concepts/cli.md Outdated Show resolved Hide resolved
docs/cloud/cloud_concepts/cli.md Outdated Show resolved Hide resolved
docs/cloud/cloud_concepts/cli.md Outdated Show resolved Hide resolved
joshmeek and others added 4 commits August 30, 2019 12:00
Co-Authored-By: Chris White <chris@prefect.io>
Co-Authored-By: Chris White <chris@prefect.io>
Co-Authored-By: Chris White <chris@prefect.io>
@joshmeek
Copy link
Author

Yeah @cicdw I already love it because it removes the need for multiple manually changing tenant-scoped tokens in my config.toml

@jlowin
Copy link
Member

jlowin commented Aug 30, 2019

Quick hits:

  • login should automatically use a default membership (if available) to switch tenants off the bat
  • disable all auth commands if a token is found in config (because it'll be given preference)
  • commands for listing tokens (name, id)
  • commands for revoking tokens (by id)

@joshmeek
Copy link
Author

@jlowin @cicdw Updated as per comments

@joshmeek joshmeek merged commit 337bf2d into master Aug 30, 2019
@joshmeek joshmeek deleted the auth_flow branch August 30, 2019 20:59
zanieb pushed a commit that referenced this pull request Mar 17, 2022
Avoid hiding the connection error when the api healthcheck fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:cli Related to the Prefect CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More Comprehensive Auth CLI commands
3 participants