Module {{.module_name}} for Dagger
A simple Dagger place the description of the module here
Configuration π οΈ
Through the Dagger CLI, or by using it directly within your module, you can configure the following options:
- βοΈ
ctr
: The container to use as a base container. If not specified, a new container is created.
- βοΈ
version
: The version of the Go image to use. Defaults to latest
.
- βοΈ
image
: The Go image to use. Defaults to golang:alpine
.
Structure ποΈ
{{.module_name_pkg}} // main module
βββ .gitattributes
βββ .gitignore
βββ LICENSE
βββ README.md
βββ apis.go
βββ cloud.go
βββ commands.go
βββ common.go
βββ config.go
βββ dagger.json
βββ examples // Sub modules that represent examples of the module's functions with each SDK
β βββ go
β βββ .gitattributes
β βββ .gitignore
β βββ dagger.json
β βββ go.mod
β βββ go.sum
β βββ main.go
β βββ testdata
β βββ common
β βββ README.md
β βββ test-file.yml
βββ go.mod
βββ go.sum
βββ main.go
βββ tests // Sub module that represent tests of the module's functions
βββ .gitattributes
βββ .gitignore
βββ dagger.json
βββ go.mod
βββ go.sum
βββ main.go
βββ testdata
βββ common
βββ README.md
βββ test-file.yml
NOTE: This structure comes out of the box if it's generated through Daggy. Just run just create <module-name>
and you'll get the structure.
Features π¨
Command or functionality |
Command |
Example |
Status |
Add your feature here |
run |
dagger call <my function> |
β
|
Using the {{.module_name}} Module π
Place the description of the module here
Usage through the Dagger CLI π
List all the functions available in the module:
# enter into the module's directory
cd {{.module_name}}
# list all the functions available in the module
dagger develop && dagger functions
Call a function:
# call a function
# dagger call <function-name> [arguments]
dagger call github.com/excoriate/daggerverse/{{.module_name}}@version <function-name> [arguments]
Testing π§ͺ
This module includes a testing module that aims to test the functionality of the {{.module_name}} module. The tests are written in Go and can be run using the following command:
## Run the tests using the just command
just test {{.module_name}}
Developer Experience π οΈ
If you'd like to contribute, mostly we use Just to automate tasks and Nix to manage the development environment. You can use the following commands to get started:
# initialize the pre-commit hooks
just init
# run CI or common things locally
just golint {{.module_name}}
# run the tests
just test {{.module_name}}
# Run the entire CI tasks locally
just cilocal {{.module_name}}
Examples (aka Recipes) π²
Additionally, this module brings a new Daggerverse functionality that allows to automatically generate the module's documentation using an special (sub) module called {{.module_name_pkg}}/examples/sdk. This module contains a set of examples hat demonstrate how to use the module's functions.
To generate the documentation
It's important to notice that each example function in order to be rendered in the documentation, it must be preprocessed by module's name, in this case (camelCase) {{.module_name}}
.
NOTE: The just
command entails the use of the Justfile for task automation. If you don't have it, don't worry, you just need Nix to run the tasks using the dev-shell
built-in command: nix develop --impure --extra-experimental-features nix-command --extra-experimental-features flakes