scan-cli-plugin
scan-cli-plugin copied to clipboard
Improve error message if the user is not logged in
- What I did
Improved the error message when not logged in. The main problem is that the suggestion to "use the Docker Login command" will not work easily if
- 2FA is required
- SSO is being enforced (so no old password logins allowed)
An advanced user can figure this out by using a PAT, but the simplest thing for most users is to log in via the Docker Desktop UI which will handle the 2FA/SSO for you transparently.
- How I did it
I listed the options in the message, leaving the simplest one for new users at the end.
- How to verify it
Before if you docker logout:
> .\docker-scan.exe scan alpine:latest
failed to get DockerScanID: You need to be logged in to Docker Hub to use scan feature.
please login to Docker Hub using the Docker Login command
After this change if you docker logout :
> .\docker-scan.exe scan alpine:latest
failed to get DockerScanID: You need to be logged in to Docker Hub to use the scan feature.
If you are not using Docker Desktop, either
- use the "docker login" CLI command with a username and password. Note this will not work if
2FA is required or if SSO enforcement is enabled on Docker Hub; or
- use the "docker login" CLI command with a username and Personal Access Token. This requires
a token to be generated in advance.
If you are using Docker Desktop: login via the UI or whale menu
- Description for the changelog
- Improve the error message if you are currently logged out.
- A picture of a cute animal (not mandatory)
