Documentation
¶
Overview ¶
Package credentials resolves registry credentials from the environment a developer or a CI runner already has.
It is public because the CLI must not be the only way to reach it. A program embedding the SDK that pushes to a registry the operator has already logged in to should not have to reimplement Docker configuration parsing, credential helpers, and host scoping to do what `devproof build` does with no configuration at all (DP-001).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Docker ¶
type Docker struct {
// contains filtered or unexported fields
}
dockerCredentials resolves registry credentials from the Docker config.
Lookups are cached for the process lifetime. Credential helpers shell out, and a push that touches one registry a few hundred times should not run a few hundred subprocesses.
func NewDocker ¶
func NewDocker(opts DockerOptions) *Docker
NewDocker returns a provider backed by the Docker configuration.
Nothing is read until the first lookup, so constructing one is free and cannot fail.
func (*Docker) Credential ¶
Credential implements artifact.CredentialProvider.
A registry with no entry gets anonymous access rather than an error: public registries exist, and failing here would make an unauthenticated pull impossible on a machine that has never run `docker login`.
type DockerOptions ¶
type DockerOptions struct {
// ConfigPath overrides the configuration location. Empty uses
// DOCKER_CONFIG when set, then ~/.docker/config.json.
ConfigPath string
// Logger receives diagnostics: an unreadable configuration, a credential
// helper named but not installed. Nil discards them, because a library
// that printed to stderr on its own would be unusable inside a server.
Logger *slog.Logger
}
DockerOptions configures a Docker provider.