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@v0.3.0Entrypoint
Return Type
Lib Example
dagger -m github.com/bradfordwagner/dagger-modules/lib@376a91c3b772a56dbcfb56a837e836e75b5582f2 call \
func (m *MyModule) Example() *dagger.Lib {
return dag.
Lib()
}@function
def example() -> dagger.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@376a91c3b772a56dbcfb56a837e836e75b5582f2 call \
open-config-yaml --src DIR_PATHfunc (m *MyModule) Example(ctx context.Context, src *dagger.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@376a91c3b772a56dbcfb56a837e836e75b5582f2 call \
arch-to-runner --arch stringfunc (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@376a91c3b772a56dbcfb56a837e836e75b5582f2 call \
arch-image-name --image string --arch stringfunc (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@376a91c3b772a56dbcfb56a837e836e75b5582f2 call \
manifest-tool --actor env:MYSECRET --token env:MYSECRET --image string --arches string1 --arches string2func (m *MyModule) Example(ctx context.Context, actor *dagger.Secret, token *dagger.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@376a91c3b772a56dbcfb56a837e836e75b5582f2 call \
container-output --c IMAGE:TAGfunc (m *MyModule) Example(ctx context.Context, c *dagger.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@376a91c3b772a56dbcfb56a837e836e75b5582f2 call \
file-contents --dir DIR_PATH --path stringfunc (m *MyModule) Example(ctx context.Context, dir *dagger.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@376a91c3b772a56dbcfb56a837e836e75b5582f2 call \
invalidate-cache --should-invalidate boolean --container IMAGE:TAGfunc (m *MyModule) Example(shouldInvalidate bool, container *dagger.Container) *dagger.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)
}