Uh oh!
There was an error while loading. Please reload this page.
login: Add message about using PATs - #4478
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@## master #4478 +/- ##
==========================================
- Coverage 59.39% 58.97% -0.43%
==========================================
Files 288 286 -2 Lines 24782 24779 -3 ==========================================
- Hits 14720 14614 -106 - Misses 9175 9278 +103
Partials 887 887 |
| // if this is a default registry (docker hub), then display the following message. | ||
| fmt.Fprintln(cli.Out(), "Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.") | ||
| fmt.Fprintln(cli.Out(), "Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com/ to create one.") | ||
| if os.Getenv("DOCKER_CLI_HINTS") != "false" { |
There was a problem hiding this comment.
0 should also be supported. It feels more natural for an env variable.
How about using strconv.ParseBool withh fallback to true (hints enabled by default) if err != nil?
There was a problem hiding this comment.
Maybe we should also handle "no", like yaml does? I'm joking, this check comes from compose-cli.
I kinda like only one possible value here
There was a problem hiding this comment.
Another nice possibility is to flip the check, have a DOCKER_NO_CLI_HINTS and only check that the variable is defined.
Examples
Line 33 in 06de1f8
Line 25 in 06de1f8
cli/cli-plugins/plugin/plugin.go
Line 36 in 06de1f8
There was a problem hiding this comment.
Personally I'd prefer DOCKER_NO_CLI_HINTS.
There was a problem hiding this comment.
DOCKER_DISABLE_CLI_HINTS would be an option.
I think we came with DOCKER_CLI_HINTS in a similar fashion as DOCKER_BUILDKIT; initially that was "opt-in", but the intent was to make that "opt-out" after incubation.
DOCKER_CLI_HINTS (and DOCKER_BUILDKIT) is more agnostic w.r.t. it being enable/disable. And can start with "opt-in" (DOCKER_CLI_HINTS=1) and when it's the default, "opt-out" (DOCKER_CLI_HINTS=0), or for situations where the config would disable it and you wanted to enable it for a specific call (through env var), as DOCKER_DISABLE_CLI_HINTS=false is kinda awkward because of the double negative.
w.r.t. accepted values, if we do look at value (beyond "non-empty"), I agree that we should use ParseBool if the value is non-empty, which would match other env-vars, such as DOCKER_BUILDKIT;
Lines 164 to 171 in 06de1f8
There was a problem hiding this comment.
+1 to ParseBool and DOCKER_NO_CLI_HINTS
There was a problem hiding this comment.
We already have DOCKER_CLI_HINTS in the wrapper (see docker/for-mac#6904 for evidence of people building on it); we might have to continue with that out of inertia, or at least propagate any changes we make here back to the Scout hints implementation (cc @eunomie)
Uh oh!
There was an error while loading. Please reload this page.
78df3b5 to
d73fc86CompareSigned-off-by: Djordje Lukic <djordje.lukic@docker.com>
vvoland
left a comment
There was a problem hiding this comment.
LGTM; it's beautiful now!
| fmt.Fprintln(cli.Out(), patSuggest) | ||
| fmt.Fprintln(cli.Out()) |
There was a problem hiding this comment.
We probably can't / shouldn't change the existing (old) hint, but perhaps we should use cli.Err() here (so that it can be redirected)
| const patSuggest = "You can log in with your password or a Personal Access " + | ||
| "Token (PAT). Using a limited-scope PAT grants better security and is required " + | ||
| "for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/" |
There was a problem hiding this comment.
Perhaps use a string-literal for this (back-tick)
There was a problem hiding this comment.
Didn’t use them because we don’t want newlines
This comment was marked as spam.
This comment was marked as spam.
neersighted
commented
Aug 16, 2023
I'm going to merge this as-is, given no further discussion around the env var, and the desire to stay consistent (for now) with what was already done in the CLI wrapper for Scout. |
- What I did
Added a hint about using PATs
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)