[Feature] Return a non-zero exit code if login fails
clintonb opened this issue · comments
Current Behavior
Calling regctl registry login
with invalid credentials returns a zero exit code. When used in GitHub Actions, the step passes despite the login failure.
$ regctl registry login ghcr.io --user "<username>" --pass "<invalid-password>"
time="2024-05-25T06:01:28Z" level=warning msg="Changing login user for registry" host=docker.io new=<username> orig=githubactions
time="2024-05-25T06:01:28Z" level=warning msg="Changing login password for registry" host=docker.io
time="2024-05-25T06:01:28Z" level=warning msg="Failed to ping registry with credentials" err="failed to ping registry ghcr.io: unauthorized"
Expected Behavior
Return a non-zero exit code so other commands are halted.
Example Solution
Version
0.6.1
Environment
- Running as binary or container:
- Host platform:
- Registry description:
Anything else
regclient/cmd/regctl/registry.go
Lines 312 to 316 in 105aee1
Thanks for the suggestion. This is fixed in #751. I can see how some would consider that a breaking change, but since there's a flag, it's easy enough for them to go back to skipping the ping, and this feels like the right behavior. Hopefully this doesn't trigger a back and forth of different users with different use cases looking for different behaviors.