lib
This module has been generated via dagger init and serves as a reference tobasic module structure as you get started with Dagger.
Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate 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/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a
Entrypoint
Return Type
Lib
Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a call \
func (m *myModule) example() *Lib {
return dag.
Lib()
}
@function
def example() -> dag.Lib:
return (
dag.lib()
)
@func()
example(): Lib {
return dag
.lib()
}
Types
Lib 🔗
openConfigYaml() 🔗
Returns lines that match a pattern in the files of the provided Directory
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
src | Directory ! | - | No description provided |
Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a call \
open-config-yaml --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *Directory) string {
return dag.
Lib().
OpenConfigYaml(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
return await (
dag.lib()
.open_config_yaml(src)
)
@func()
async example(src: Directory): Promise<string> {
return dag
.lib()
.openConfigYaml(src)
}
archToRunner() 🔗
Returns the runner to run on for the given architecture
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
arch | String ! | - | No description provided |
Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a call \
arch-to-runner --arch string
func (m *myModule) example(ctx context.Context, arch string) string {
return dag.
Lib().
ArchToRunner(ctx, arch)
}
@function
async def example(arch: str) -> str:
return await (
dag.lib()
.arch_to_runner(arch)
)
@func()
async example(arch: string): Promise<string> {
return dag
.lib()
.archToRunner(arch)
}
archImageName() 🔗
ArchImageName returns the image name for the given image and architecture
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
image | String ! | - | No description provided |
arch | String ! | - | No description provided |
Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a call \
arch-image-name --image string --arch string
func (m *myModule) example(ctx context.Context, image string, arch string) string {
return dag.
Lib().
ArchImageName(ctx, image, arch)
}
@function
async def example(image: str, arch: str) -> str:
return await (
dag.lib()
.arch_image_name(image, arch)
)
@func()
async example(image: string, arch: string): Promise<string> {
return dag
.lib()
.archImageName(image, arch)
}
manifestTool() 🔗
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
actor | Secret ! | - | GitHub actor, --token=env:github_actor,--token=cmd:"gh auth token" |
token | Secret ! | - | GitHub API token, --token=env:github_token,--token=cmd:"gh auth token" |
image | String ! | - | No description provided |
arches | [String ! ] ! | - | No description provided |
Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a call \
manifest-tool --actor env:MYSECRET --token env:MYSECRET --image string --arches string1 --arches string2
func (m *myModule) example(ctx context.Context, actor *Secret, token *Secret, image string, arches []string) string {
return dag.
Lib().
ManifestTool(ctx, actor, token, image, arches)
}
@function
async def example(actor: dagger.Secret, token: dagger.Secret, image: str, arches: List[str]) -> str:
return await (
dag.lib()
.manifest_tool(actor, token, image, arches)
)
@func()
async example(actor: Secret, token: Secret, image: string, arches: string[]): Promise<string> {
return dag
.lib()
.manifestTool(actor, token, image, arches)
}
containerOutput() 🔗
ContainerOutput returns the output of a container as a string if stderr exists return that, else stdout
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
c | Container ! | - | No description provided |
Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a call \
container-output --c IMAGE:TAG
func (m *myModule) example(ctx context.Context, c *Container) string {
return dag.
Lib().
ContainerOutput(ctx, c)
}
@function
async def example(c: dagger.Container) -> str:
return await (
dag.lib()
.container_output(c)
)
@func()
async example(c: Container): Promise<string> {
return dag
.lib()
.containerOutput(c)
}
fileContents() 🔗
FileContents - returns the contents of a file in a directory
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
dir | Directory ! | - | No description provided |
path | String ! | - | No description provided |
Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a call \
file-contents --dir DIR_PATH --path string
func (m *myModule) example(ctx context.Context, dir *Directory, path string) string {
return dag.
Lib().
FileContents(ctx, dir, path)
}
@function
async def example(dir: dagger.Directory, path: str) -> str:
return await (
dag.lib()
.file_contents(dir, path)
)
@func()
async example(dir: Directory, path: string): Promise<string> {
return dag
.lib()
.fileContents(dir, path)
}
invalidateCache() 🔗
InvalidateCache invalidates the cache if the shouldInvalidate is true
Return Type
Container !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
shouldInvalidate | Boolean ! | - | No description provided |
container | Container ! | - | No description provided |
Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@d4d9694352d38da6840d72bc1755fb3ceef7077a call \
invalidate-cache --should-invalidate boolean --container IMAGE:TAG
func (m *myModule) example(shouldInvalidate bool, container *Container) *Container {
return dag.
Lib().
InvalidateCache(shouldInvalidate, container)
}
@function
def example(should_invalidate: bool, container: dagger.Container) -> dagger.Container:
return (
dag.lib()
.invalidate_cache(should_invalidate, container)
)
@func()
example(shouldInvalidate: boolean, container: Container): Container {
return dag
.lib()
.invalidateCache(shouldInvalidate, container)
}