module-template
This module has been generated via dagger init and serves as a reference tobasic module structure as you get started with Dagger. The module demonstrates
usage of arguments and return types using simple echo and grep commands. The functions
can be called from the dagger CLI or from one of the SDKs.
The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.
Installation
dagger install github.com/Excoriate/daggerverse/module-template@v0.5.0
Entrypoint
Return Type
ModuleTemplate !
Arguments
Name | Type | Description |
---|---|---|
version | String | version is the version of the container image to use. |
image | String | image is the container image to use. |
ctr | Container | ctr is the container to use as a base container. |
envVarsFromHost | [String ! ] | envVarsFromHost is a list of environment variables to pass from the host to the container in a slice of strings. |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
func (m *myModule) example() *ModuleTemplate {
return dag.
ModuleTemplate()
}
@function
def example() -> dag.ModuleTemplate:
return (
dag.module_template()
)
@func()
example(): ModuleTemplate {
return dag
.moduleTemplate()
}
Types
ModuleTemplate 🔗
ModuleTemplate is a Dagger module. This module is used to create and manage containers.
ctr() 🔗
Ctr is the container to use as a base container.
Return Type
Container !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
ctr
func (m *myModule) example() *Container {
return dag.
ModuleTemplate().
Ctr()
}
@function
def example() -> dagger.Container:
return (
dag.module_template()
.ctr()
)
@func()
example(): Container {
return dag
.moduleTemplate()
.ctr()
}
base() 🔗
Base sets the base image and version, and creates the base container.
The default image is “alpine/latest” and the default version is “latest”.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
imageUrl | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
base --image-url string
func (m *myModule) example(imageUrl string) *ModuleTemplate {
return dag.
ModuleTemplate().
Base(imageUrl)
}
@function
def example(image_url: str) -> dag.ModuleTemplate:
return (
dag.module_template()
.base(image_url)
)
@func()
example(imageUrl: string): ModuleTemplate {
return dag
.moduleTemplate()
.base(imageUrl)
}
baseAlpine() 🔗
BaseAlpine sets the base image to an Alpine Linux image and creates the base container.
Parameters: - version: The version of the Alpine image to use. Optional parameter. Defaults to “latest”.
Returns a pointer to the ModuleTemplate instance.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
version | String | - | version is the version of the Alpine image to use, e.g., "3.17.3". |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
base-alpine
func (m *myModule) example() *ModuleTemplate {
return dag.
ModuleTemplate().
BaseAlpine()
}
@function
def example() -> dag.ModuleTemplate:
return (
dag.module_template()
.base_alpine()
)
@func()
example(): ModuleTemplate {
return dag
.moduleTemplate()
.baseAlpine()
}
baseUbuntu() 🔗
BaseUbuntu sets the base image to an Ubuntu Linux image and creates the base container.
Parameters: - version: The version of the Ubuntu image to use. Optional parameter. Defaults to “latest”.
Returns a pointer to the ModuleTemplate instance.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
version | String | - | version is the version of the Ubuntu image to use, e.g., "22.04". |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
base-ubuntu
func (m *myModule) example() *ModuleTemplate {
return dag.
ModuleTemplate().
BaseUbuntu()
}
@function
def example() -> dag.ModuleTemplate:
return (
dag.module_template()
.base_ubuntu()
)
@func()
example(): ModuleTemplate {
return dag
.moduleTemplate()
.baseUbuntu()
}
baseBusyBox() 🔗
BaseBusyBox sets the base image to a BusyBox Linux image and creates the base container.
Parameters: - version: The version of the BusyBox image to use. Optional parameter. Defaults to “latest”.
Returns a pointer to the ModuleTemplate instance.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
version | String | - | version is the version of the BusyBox image to use, e.g., "1.35.0". |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
base-busy-box
func (m *myModule) example() *ModuleTemplate {
return dag.
ModuleTemplate().
BaseBusyBox()
}
@function
def example() -> dag.ModuleTemplate:
return (
dag.module_template()
.base_busy_box()
)
@func()
example(): ModuleTemplate {
return dag
.moduleTemplate()
.baseBusyBox()
}
openTerminal() 🔗
OpenTerminal returns a terminal
It returns a terminal for the container. Arguments: - None. Returns: - *Terminal: The terminal for the container.
Return Type
Container !
Example
no available example in current language
// ModuleTemplateOpenTerminal demonstrates how to open an interactive terminal session
// within a ModuleTemplate module container.
//
// This function showcases the initialization and configuration of a
// ModuleTemplate module container using various options like enabling Cgo,
// utilizing build cache, and including a GCC compiler.
//
// Parameters:
// - None
//
// Returns:
// - *dagger.Container: A configured Dagger container with an open terminal.
//
// Usage:
//
// This function can be used to interactively debug or inspect the
// container environment during test execution.
func (m *Go) ModuleTemplateOpenTerminal() *dagger.Container {
// Configure the ModuleTemplate module container with necessary options
targetModule := dag.ModuleTemplate()
// Retrieve and discard standard output
_, _ = targetModule.Ctr().
Stdout(context.Background())
// Open and return the terminal session in the configured container
return targetModule.Ctr().
Terminal()
}
no available example in current language
no available example in current language
runShell() 🔗
RunShell runs a shell command in the container.
It runs a shell command in the container and returns the output. Arguments: - cmd: The command to run in the container. Returns: - string: The output of the command. - error: An error if the command fails.
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
cmd | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
run-shell --cmd string
func (m *myModule) example(ctx context.Context, cmd string) string {
return dag.
ModuleTemplate().
RunShell(ctx, cmd)
}
@function
async def example(cmd: str) -> str:
return await (
dag.module_template()
.run_shell(cmd)
)
@func()
async example(cmd: string): Promise<string> {
return dag
.moduleTemplate()
.runShell(cmd)
}
printEnvVars() 🔗
PrintEnvVars retrieves and prints the environment variables of the container.
It executes the printenv
command inside the container to get a list of all
environment variables and their respective values.
Arguments: - None.
Returns: - string: A string containing all environment variables in the format “KEY=VALUE”, separated by newlines. - error: An error if the command fails, wrapped with additional context.
Usage example: “`go envVars, err := ModuleTemplateInstance.PrintEnvVars()
if err != nil {
log.Fatalf("Error retrieving environment variables: %v", err)
}
fmt.Println(envVars).
Return Type
String !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
print-env-vars
func (m *myModule) example(ctx context.Context) string {
return dag.
ModuleTemplate().
PrintEnvVars(ctx)
}
@function
async def example() -> str:
return await (
dag.module_template()
.print_env_vars()
)
@func()
async example(): Promise<string> {
return dag
.moduleTemplate()
.printEnvVars()
}
inspectEnvVar() 🔗
InspectEnvVar inspects the value of an environment variable by its key Arguments: - key: The environment variable key to inspect. Returns: - string: The value of the environment variable. - error: An error if the key is invalid or the environment variable is not found.
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
key | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
inspect-env-var --key string
func (m *myModule) example(ctx context.Context, key string) string {
return dag.
ModuleTemplate().
InspectEnvVar(ctx, key)
}
@function
async def example(key: str) -> str:
return await (
dag.module_template()
.inspect_env_var(key)
)
@func()
async example(key: string): Promise<string> {
return dag
.moduleTemplate()
.inspectEnvVar(key)
}
downloadFile() 🔗
DownloadFile downloads a file from the specified URL.
Parameters: - url: The URL of the file to download. - destFileName: The name of the file to download. Optional parameter. If not set, it’ll default to the basename of the URL.
Returns: - *dagger.File: The downloaded file.
Functionality:
This method downloads a file from the provided URL. If the destination file name is not specified, it defaults to the basename of the URL. The downloaded file is then returned as a *dagger.File.
Return Type
File !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
url | String ! | - | url is the URL of the file to download. |
destFileName | String | - | destFileName is the name of the file to download. If not set, it'll default to the basename of the URL. |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
download-file --url string
func (m *myModule) example(url string) *File {
return dag.
ModuleTemplate().
DownloadFile(url)
}
@function
def example(url: str) -> dagger.File:
return (
dag.module_template()
.download_file(url)
)
@func()
example(url: string): File {
return dag
.moduleTemplate()
.downloadFile(url)
}
cloneGitRepo() 🔗
CloneGitRepo clones a Git repository into a Dagger Directory.
Parameters: - repoURL: The URL of the git repository to clone (e.g., “https://github.com/user/repo”). - token: (Optional) The VCS token to use for authentication. If not provided, the repository will be cloned without authentication. - vcs: (Optional) The version control system (VCS) to use for authentication. Defaults to “github”. Supported values are “github” and “gitlab”.
Returns: - *dagger.Directory: A directory object representing the cloned repository.
If a token is provided, it will be securely set using Dagger’s secret mechanism and used for authentication during the clone operation.
Return Type
Directory !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repoUrl | String ! | - | repoURL is the URL of the git repo to clone. |
token | String | - | token is the VCS token to use for authentication. Optional parameter. |
vcs | String | - | vcs is the VCS to use for authentication. Optional parameter. |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
clone-git-repo --repo-url string
func (m *myModule) example(repoUrl string) *Directory {
return dag.
ModuleTemplate().
CloneGitRepo(repoUrl)
}
@function
def example(repo_url: str) -> dagger.Directory:
return (
dag.module_template()
.clone_git_repo(repo_url)
)
@func()
example(repoUrl: string): Directory {
return dag
.moduleTemplate()
.cloneGitRepo(repoUrl)
}
withAwskeys() 🔗
WithAWSKeys sets AWS credentials as environment variables. awsKeyId is the AWS Access Key ID. awsSecretAccessKey is the AWS Secret Access Key. awsSessionToken is the AWS Session Token; optional. awsRegion is the AWS Region; optional. awsProfile is the AWS Profile; optional.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
awsKeyId | Secret ! | - | awsKeyId is the AWS Access Key ID. |
awsSecretAccessKey | Secret ! | - | awsSecretAccessKey is the AWS Secret Access Key. |
awsSessionToken | Secret | - | awsSessionToken is the AWS Session Token; optional. |
awsRegion | Secret | - | awsRegion is the AWS Region; optional. |
awsProfile | Secret | - | awsProfile is the AWS Profile; optional. |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-awskeys --aws-key-id env:MYSECRET --aws-secret-access-key env:MYSECRET
func (m *myModule) example(awsKeyId *Secret, awsSecretAccessKey *Secret) *ModuleTemplate {
return dag.
ModuleTemplate().
WithAwskeys(awsKeyId, awsSecretAccessKey)
}
@function
def example(aws_key_id: dagger.Secret, aws_secret_access_key: dagger.Secret) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_awskeys(aws_key_id, aws_secret_access_key)
)
@func()
example(awsKeyId: Secret, awsSecretAccessKey: Secret): ModuleTemplate {
return dag
.moduleTemplate()
.withAwskeys(awsKeyId, awsSecretAccessKey)
}
withAzureCredentials() 🔗
WithAzureCredentials sets Azure credentials as environment variables. azureClientId is the Azure Client ID. azureClientSecret is the Azure Client Secret. azureTenantId is the Azure Tenant ID.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
azureClientId | Secret ! | - | azureClientId is the Azure Client ID. |
azureClientSecret | Secret ! | - | azureClientSecret is the Azure Client Secret. |
azureTenantId | Secret ! | - | azureTenantId is the Azure Tenant ID. |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-azure-credentials --azure-client-id env:MYSECRET --azure-client-secret env:MYSECRET --azure-tenant-id env:MYSECRET
func (m *myModule) example(azureClientId *Secret, azureClientSecret *Secret, azureTenantId *Secret) *ModuleTemplate {
return dag.
ModuleTemplate().
WithAzureCredentials(azureClientId, azureClientSecret, azureTenantId)
}
@function
def example(azure_client_id: dagger.Secret, azure_client_secret: dagger.Secret, azure_tenant_id: dagger.Secret) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_azure_credentials(azure_client_id, azure_client_secret, azure_tenant_id)
)
@func()
example(azureClientId: Secret, azureClientSecret: Secret, azureTenantId: Secret): ModuleTemplate {
return dag
.moduleTemplate()
.withAzureCredentials(azureClientId, azureClientSecret, azureTenantId)
}
withEnvironmentVariable() 🔗
WithEnvironmentVariable sets an environment variable in the container.
Parameters:
- name: The name of the environment variable (e.g., “HOST”).
- value: The value of the environment variable (e.g., “localhost”).
- expand: Whether to replace ${VAR}
or \(VAR in the value according to the current
environment variables defined in the container (e.g., "/opt/bin:\)PATH”).
Optional parameter.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
name | String ! | - | name is the name of the environment variable. |
value | String ! | - | value is the value of the environment variable. |
expand | Boolean | - | expand is whether to replace `${VAR}` or $VAR in the value according to the current |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-environment-variable --name string --value string
func (m *myModule) example(name string, value string) *ModuleTemplate {
return dag.
ModuleTemplate().
WithEnvironmentVariable(name, value)
}
@function
def example(name: str, value: str) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_environment_variable(name, value)
)
@func()
example(name: string, value: string): ModuleTemplate {
return dag
.moduleTemplate()
.withEnvironmentVariable(name, value)
}
withSource() 🔗
WithSource sets the source directory for the container.
Parameters: - src: The directory that contains all the source code, including the module directory. - workdir: The working directory within the container. Optional parameter.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
src | Directory ! | - | src is the directory that contains all the source code, including the module directory. |
workdir | String | - | workdir is the working directory within the container. If not set it'll default to /mnt |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-source --src DIR_PATH
func (m *myModule) example(src *Directory) *ModuleTemplate {
return dag.
ModuleTemplate().
WithSource(src)
}
@function
def example(src: dagger.Directory) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_source(src)
)
@func()
example(src: Directory): ModuleTemplate {
return dag
.moduleTemplate()
.withSource(src)
}
withContainer() 🔗
WithContainer sets the container to be used.
Parameters: - ctr: The container to run the command in. If passed, it will override the container set in the Dagger instance.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
ctr | Container ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-container --ctr IMAGE:TAG
func (m *myModule) example(ctr *Container) *ModuleTemplate {
return dag.
ModuleTemplate().
WithContainer(ctr)
}
@function
def example(ctr: dagger.Container) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_container(ctr)
)
@func()
example(ctr: Container): ModuleTemplate {
return dag
.moduleTemplate()
.withContainer(ctr)
}
withDockerService() 🔗
WithDockerService sets up the container with the Docker service.
It sets up the container with the Docker service. Parameters: - dockerVersion: The version of the Docker engine to use, e.g., “v20.10.17”. Optional parameter. If not provided, a default version is used.
Return Type
Service !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
dockerVersion | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-docker-service --docker-version string
func (m *myModule) example(dockerVersion string) *Service {
return dag.
ModuleTemplate().
WithDockerService(dockerVersion)
}
@function
def example(docker_version: str) -> dagger.Service:
return (
dag.module_template()
.with_docker_service(docker_version)
)
@func()
example(dockerVersion: string): Service {
return dag
.moduleTemplate()
.withDockerService(dockerVersion)
}
withFileMountedInContainer() 🔗
WithFileMountedInContainer adds a file to the container.
Parameters: - file: The file to add to the container. - dest: The destination path in the container. Optional parameter. - owner: The owner of the file. Optional parameter.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
file | File ! | - | No description provided |
dest | String ! | - | No description provided |
owner | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-file-mounted-in-container --file file:path --dest string --owner string
func (m *myModule) example(file *File, dest string, owner string) *ModuleTemplate {
return dag.
ModuleTemplate().
WithFileMountedInContainer(file, dest, owner)
}
@function
def example(file: dagger.File, dest: str, owner: str) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_file_mounted_in_container(file, dest, owner)
)
@func()
example(file: File, dest: string, owner: string): ModuleTemplate {
return dag
.moduleTemplate()
.withFileMountedInContainer(file, dest, owner)
}
withGitInAlpineContainer() 🔗
WithGitInAlpineContainer installs Git in the golang/alpine container.
It installs Git in the golang/alpine container.
Return Type
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-git-in-alpine-container
func (m *myModule) example() *ModuleTemplate {
return dag.
ModuleTemplate().
WithGitInAlpineContainer()
}
@function
def example() -> dag.ModuleTemplate:
return (
dag.module_template()
.with_git_in_alpine_container()
)
@func()
example(): ModuleTemplate {
return dag
.moduleTemplate()
.withGitInAlpineContainer()
}
withNewNetrcFileGitHub() 🔗
WithNewNetrcFileGitHub creates a new .netrc file with the GitHub credentials.
The .netrc file is created in the root directory of the container.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
username | String ! | - | No description provided |
password | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-new-netrc-file-git-hub --username string --password string
func (m *myModule) example(username string, password string) *ModuleTemplate {
return dag.
ModuleTemplate().
WithNewNetrcFileGitHub(username, password)
}
@function
def example(username: str, password: str) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_new_netrc_file_git_hub(username, password)
)
@func()
example(username: string, password: string): ModuleTemplate {
return dag
.moduleTemplate()
.withNewNetrcFileGitHub(username, password)
}
withNewNetrcFileAsSecretGitHub() 🔗
WithNewNetrcFileAsSecretGitHub creates a new .netrc file with the GitHub credentials.
The .netrc file is created in the root directory of the container. The argument ‘password’ is a secret that is not exposed in the logs.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
username | String ! | - | No description provided |
password | Secret ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-new-netrc-file-as-secret-git-hub --username string --password env:MYSECRET
func (m *myModule) example(username string, password *Secret) *ModuleTemplate {
return dag.
ModuleTemplate().
WithNewNetrcFileAsSecretGitHub(username, password)
}
@function
def example(username: str, password: dagger.Secret) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_new_netrc_file_as_secret_git_hub(username, password)
)
@func()
example(username: string, password: Secret): ModuleTemplate {
return dag
.moduleTemplate()
.withNewNetrcFileAsSecretGitHub(username, password)
}
withNewNetrcFileGitLab() 🔗
WithNewNetrcFileGitLab creates a new .netrc file with the GitLab credentials.
The .netrc file is created in the root directory of the container.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
username | String ! | - | No description provided |
password | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-new-netrc-file-git-lab --username string --password string
func (m *myModule) example(username string, password string) *ModuleTemplate {
return dag.
ModuleTemplate().
WithNewNetrcFileGitLab(username, password)
}
@function
def example(username: str, password: str) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_new_netrc_file_git_lab(username, password)
)
@func()
example(username: string, password: string): ModuleTemplate {
return dag
.moduleTemplate()
.withNewNetrcFileGitLab(username, password)
}
withNewNetrcFileAsSecretGitLab() 🔗
WithNewNetrcFileAsSecretGitLab creates a new .netrc file with the GitLab credentials.
The .netrc file is created in the root directory of the container. The argument ‘password’ is a secret that is not exposed in the logs.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
username | String ! | - | No description provided |
password | Secret ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-new-netrc-file-as-secret-git-lab --username string --password env:MYSECRET
func (m *myModule) example(username string, password *Secret) *ModuleTemplate {
return dag.
ModuleTemplate().
WithNewNetrcFileAsSecretGitLab(username, password)
}
@function
def example(username: str, password: dagger.Secret) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_new_netrc_file_as_secret_git_lab(username, password)
)
@func()
example(username: string, password: Secret): ModuleTemplate {
return dag
.moduleTemplate()
.withNewNetrcFileAsSecretGitLab(username, password)
}
withUtilitiesInAlpineContainer() 🔗
WithUtilitiesInAlpineContainer installs common utilities in the golang/alpine container.
It installs utilities such as curl, wget, and others that are commonly used.
Return Type
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-utilities-in-alpine-container
func (m *myModule) example() *ModuleTemplate {
return dag.
ModuleTemplate().
WithUtilitiesInAlpineContainer()
}
@function
def example() -> dag.ModuleTemplate:
return (
dag.module_template()
.with_utilities_in_alpine_container()
)
@func()
example(): ModuleTemplate {
return dag
.moduleTemplate()
.withUtilitiesInAlpineContainer()
}
withSecretAsEnvVar() 🔗
WithSecretAsEnvVar sets an environment variable in the container using a secret.
Parameters: - name: The name of the environment variable (e.g., “API_KEY”). - secret: The secret containing the value of the environment variable.
Returns: - *ModuleTemplate: The updated ModuleTemplate with the environment variable set.
Behavior: - The secret value is expanded according to the current environment variables defined in the container.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
name | String ! | - | No description provided |
secret | Secret ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-secret-as-env-var --name string --secret env:MYSECRET
func (m *myModule) example(name string, secret *Secret) *ModuleTemplate {
return dag.
ModuleTemplate().
WithSecretAsEnvVar(name, secret)
}
@function
def example(name: str, secret: dagger.Secret) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_secret_as_env_var(name, secret)
)
@func()
example(name: string, secret: Secret): ModuleTemplate {
return dag
.moduleTemplate()
.withSecretAsEnvVar(name, secret)
}
withDownloadedFile() 🔗
WithDownloadedFile downloads a file from the specified URL and mounts it in the container.
Parameters: - url: The URL of the file to download. - destDir: The directory within the container where the file will be downloaded. Optional parameter. If not provided, it defaults to the predefined mount prefix.
Returns: - *ModuleTemplate: The updated ModuleTemplate with the downloaded file mounted in the container.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
url | String ! | - | url is the URL of the file to download. |
destFileName | String | - | destFileName is the name of the file to download. If not set, it'll default to the basename of the URL. |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-downloaded-file --url string
func (m *myModule) example(url string) *ModuleTemplate {
return dag.
ModuleTemplate().
WithDownloadedFile(url)
}
@function
def example(url: str) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_downloaded_file(url)
)
@func()
example(url: string): ModuleTemplate {
return dag
.moduleTemplate()
.withDownloadedFile(url)
}
withClonedGitRepo() 🔗
WithClonedGitRepo clones a Git repository and mounts it as a directory in the container.
This method downloads a Git repository and mounts it as a directory in the container. It supports optional authentication tokens for private repositories and can handle both GitHub and GitLab repositories.
Parameters: - repoURL: The URL of the git repository to clone (e.g., “https://github.com/user/repo”). - token: (Optional) The VCS token to use for authentication. If not provided, the repository will be cloned without authentication. - vcs: (Optional) The version control system (VCS) to use for authentication. Defaults to “github”. Supported values are “github” and “gitlab”.
Returns: - *ModuleTemplate: The updated ModuleTemplate with the cloned repository mounted in the container.
Return Type
ModuleTemplate !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
repoUrl | String ! | - | No description provided |
token | String | - | token is the VCS token to use for authentication. Optional parameter. |
vcs | String | - | vcs is the VCS to use for authentication. Optional parameter. |
Example
dagger -m github.com/Excoriate/daggerverse/module-template@1fd496d42652a4f1cd6502e34ac36e52f5e82d60 call \
with-cloned-git-repo --repo-url string
func (m *myModule) example(repoUrl string) *ModuleTemplate {
return dag.
ModuleTemplate().
WithClonedGitRepo(repoUrl)
}
@function
def example(repo_url: str) -> dag.ModuleTemplate:
return (
dag.module_template()
.with_cloned_git_repo(repo_url)
)
@func()
example(repoUrl: string): ModuleTemplate {
return dag
.moduleTemplate()
.withClonedGitRepo(repoUrl)
}