Dagger
Search

oci-login

Generate an OCI registry authentication file that provides a secure authentication
approach for any tool that performs a login operation. Tools such as apko and helm,
provide dedicated login commands that write credentials to disk, which Dagger
ultimately caches. With this approach, a registry authentication file can (and should)
be mounted as a dedicated secret to avoid caching.

Installation

dagger install github.com/purpleclay/daggerverse/oci-login@v0.2.0

Entrypoint

Return Type
OciLogin !
Example
dagger -m github.com/purpleclay/daggerverse/oci-login@6bd87ae249e7a019d5699a640c741591920aceca call \
func (m *myModule) example() *OciLogin  {
	return dag.
			OciLogin()
}
@function
def example() -> dag.OciLogin:
	return (
		dag.oci_login()
	)
@func()
example(): OciLogin {
	return dag
		.ociLogin()
}

Types

OciLogin 🔗

OCI Login dagger module

withAuth() 🔗

Configure credentials for authenticating to an image registry. Can be chained to configure multiple credentials in a single pass

Return Type
OciLogin !
Arguments
NameTypeDefault ValueDescription
hostnameString !-the hostname (e.g. docker.io) or namespace (e.g. quay.io/user/image) of the registry to authenticate with
usernameString !-the name of the user to authenticate with
passwordSecret !-the password for the user to authenticate with
Example
dagger -m github.com/purpleclay/daggerverse/oci-login@6bd87ae249e7a019d5699a640c741591920aceca call \
 with-auth --hostname string --username string --password env:MYSECRET
func (m *myModule) example(hostname string, username string, password *Secret) *OciLogin  {
	return dag.
			OciLogin().
			WithAuth(hostname, username, password)
}
@function
def example(hostname: str, username: str, password: dagger.Secret) -> dag.OciLogin:
	return (
		dag.oci_login()
		.with_auth(hostname, username, password)
	)
@func()
example(hostname: string, username: string, password: Secret): OciLogin {
	return dag
		.ociLogin()
		.withAuth(hostname, username, password)
}

asConfig() 🔗

Generates a JSON representation of the current OCI login configuration as a file

Return Type
File !
Example
dagger -m github.com/purpleclay/daggerverse/oci-login@6bd87ae249e7a019d5699a640c741591920aceca call \
 as-config
func (m *myModule) example() *File  {
	return dag.
			OciLogin().
			AsConfig()
}
@function
def example() -> dagger.File:
	return (
		dag.oci_login()
		.as_config()
	)
@func()
example(): File {
	return dag
		.ociLogin()
		.asConfig()
}

asSecret() 🔗

Generates a JSON representation of the current OCI login configuration as a secret

Return Type
Secret !
Arguments
NameTypeDefault ValueDescription
nameString -a name for the generated secret, defaults to oci-config-x, where x is the md5 hash of the config
Example
dagger -m github.com/purpleclay/daggerverse/oci-login@6bd87ae249e7a019d5699a640c741591920aceca call \
 as-secret
func (m *myModule) example() *Secret  {
	return dag.
			OciLogin().
			AsSecret()
}
@function
def example() -> dagger.Secret:
	return (
		dag.oci_login()
		.as_secret()
	)
@func()
example(): Secret {
	return dag
		.ociLogin()
		.asSecret()
}