Dagger
Search

netrc

Generate a .netrc auto-login configuration file that provides a secure authentication
approach for transparently authenticating against a remote machine. Tools like Git provide
out-of-the-box support for a .netrc auto-login configuration file, making accessing
private repositories painless, especially for languages such as Go. The generated .netrc
file can (and should) be mounted as a dedicated secret to avoid caching.

Installation

dagger install github.com/purpleclay/daggerverse/netrc@v0.1.0

Entrypoint

Return Type
Netrc !
Example
dagger -m github.com/purpleclay/daggerverse/netrc@b211f65ebcaccd88147499f0527c3e816655c867 call \
func (m *myModule) example() *Netrc  {
	return dag.
			Netrc()
}
@function
def example() -> dag.Netrc:
	return (
		dag.netrc()
	)
@func()
example(): Netrc {
	return dag
		.netrc()
}

Types

Netrc 🔗

Netrc dagger module

withLogin() 🔗

Configures an auto-login configuration for a remote machine with the given credentials. Can be chained to configure multiple auto-logins in a single pass

Return Type
Netrc !
Arguments
NameTypeDefault ValueDescription
machineString !-the remote machine name
usernameString !-a user on the remote machine that can login
passwordSecret !-a token (or password) used to login into a remote machine by the identified user
Example
dagger -m github.com/purpleclay/daggerverse/netrc@b211f65ebcaccd88147499f0527c3e816655c867 call \
 with-login --machine string --username string --password env:MYSECRET
func (m *myModule) example(machine string, username string, password *Secret) *Netrc  {
	return dag.
			Netrc().
			WithLogin(machine, username, password)
}
@function
def example(machine: str, username: str, password: dagger.Secret) -> dag.Netrc:
	return (
		dag.netrc()
		.with_login(machine, username, password)
	)
@func()
example(machine: string, username: string, password: Secret): Netrc {
	return dag
		.netrc()
		.withLogin(machine, username, password)
}

asFile() 🔗

Generates and returns a .netrc file based on the current configuration

Return Type
File !
Example
dagger -m github.com/purpleclay/daggerverse/netrc@b211f65ebcaccd88147499f0527c3e816655c867 call \
 as-file
func (m *myModule) example() *File  {
	return dag.
			Netrc().
			AsFile()
}
@function
def example() -> dagger.File:
	return (
		dag.netrc()
		.as_file()
	)
@func()
example(): File {
	return dag
		.netrc()
		.asFile()
}

asSecret() 🔗

Generates and returns a .netrc file based on the current configuration that can be mounted as a secret to a container

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