netrc
Generate a .netrc auto-login configuration file that provides a secure authenticationapproach 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.3.0Entrypoint
Return Type
Netrc !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| format | Enum ! | "compact" | the format when generating the auto-login configuration file (compact,full) |
Example
dagger -m github.com/purpleclay/daggerverse/netrc@3893340aa32e2140d6181124740f0a0a23e59588 call \
func (m *MyModule) Example(format ) *dagger.Netrc {
return dag.
Netrc(format)
}@function
def example(format: ) -> dagger.Netrc:
return (
dag.netrc(format)
)@func()
example(format: ): Netrc {
return dag
.netrc(format)
}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
| Name | Type | Default Value | Description |
|---|---|---|---|
| machine | String ! | - | the remote machine name |
| username | Secret ! | - | a user on the remote machine that can login |
| password | Secret ! | - | a token (or password) used to login into a remote machine by the identified user |
Example
dagger -m github.com/purpleclay/daggerverse/netrc@3893340aa32e2140d6181124740f0a0a23e59588 call \
with-login --machine string --username env:MYSECRET --password env:MYSECRETfunc (m *MyModule) Example(format , machine string, username *dagger.Secret, password *dagger.Secret) *dagger.Netrc {
return dag.
Netrc(format).
WithLogin(machine, username, password)
}@function
def example(format: , machine: str, username: dagger.Secret, password: dagger.Secret) -> dagger.Netrc:
return (
dag.netrc(format)
.with_login(machine, username, password)
)@func()
example(format: , machine: string, username: Secret, password: Secret): Netrc {
return dag
.netrc(format)
.withLogin(machine, username, password)
}withFile() 🔗
Loads an existing auto-login configuration from a file. Can be chained to load multiple configuration files in a single pass
Return Type
Netrc !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| cfg | File ! | - | an existing auto-login configuration file |
Example
dagger -m github.com/purpleclay/daggerverse/netrc@3893340aa32e2140d6181124740f0a0a23e59588 call \
with-file --cfg file:pathfunc (m *MyModule) Example(format , cfg *dagger.File) *dagger.Netrc {
return dag.
Netrc(format).
WithFile(cfg)
}@function
def example(format: , cfg: dagger.File) -> dagger.Netrc:
return (
dag.netrc(format)
.with_file(cfg)
)@func()
example(format: , cfg: File): Netrc {
return dag
.netrc(format)
.withFile(cfg)
}asFile() 🔗
Generates and returns a .netrc file based on the current configuration
Return Type
File ! Example
dagger -m github.com/purpleclay/daggerverse/netrc@3893340aa32e2140d6181124740f0a0a23e59588 call \
as-filefunc (m *MyModule) Example(format ) *dagger.File {
return dag.
Netrc(format).
AsFile()
}@function
def example(format: ) -> dagger.File:
return (
dag.netrc(format)
.as_file()
)@func()
example(format: ): File {
return dag
.netrc(format)
.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
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String | - | 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@3893340aa32e2140d6181124740f0a0a23e59588 call \
as-secretfunc (m *MyModule) Example(format ) *dagger.Secret {
return dag.
Netrc(format).
AsSecret()
}@function
def example(format: ) -> dagger.Secret:
return (
dag.netrc(format)
.as_secret()
)@func()
example(format: ): Secret {
return dag
.netrc(format)
.asSecret()
}