feat: add registry:auth-status to read back login state

There was no way to ask whether Dokku was already logged in to a registry with a given credential, so tooling converging a declared state onto a server had to re-run `registry:login` on every pass purely to discover that nothing needed to change. The new `registry:auth-status` command compares a supplied credential against the stored one and reports the result through its exit code alone, distinguishing a server with no credential from one whose credential differs, and from one whose secret a docker credential helper or an identity token puts out of reach. An `auth-servers` triad on `registry:report` exposes which servers have credentials without emitting any part of one.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-09-19 19:19:57 -04:00
1 parent 2e3d144aca
commit 624eea1959
11 files changed
+877 -12

No files matched your search

+24
View File
@@ -16,6 +16,30 @@ type ErrWithExitCode interface {
ExitCode() int
}
// ExitCodeError carries an explicit exit code for a command failure. A blank
// Message exits with the code without printing anything, which suits commands
// that report their result through the exit code alone.
type ExitCodeError struct {
// Code is the exit code to terminate with
Code int
// Message is the error text printed to stderr, if any
Message string
}
var _ ErrWithExitCode = (*ExitCodeError)(nil)
// Error returns the error text to print to stderr
func (e *ExitCodeError) Error() string {
return e.Message
}
// ExitCode returns an exit code to use in case this error bubbles
// up into an os.Exit() call
func (e *ExitCodeError) ExitCode() int {
return e.Code
}
type writer struct {
mu *sync.Mutex
source string