Skip to main content
Version: 1.0-beta

Calling functions

dagger check, dagger generate, and dagger start are conveniences built on top of the underlying primitive: calling a module's functions. When you need something those verbs don't cover, call functions directly.

dagger api call go module --path=. test

Discover functions​

List the functions available in your workspace:

dagger api functions

List the functions on a specific module:

dagger api functions go

Every function and its arguments are also visible through --help:

dagger api call go --help

Pass arguments​

Arguments are flags on the function that accepts them:

dagger api call go --version=1.25 module --path=. test

Secrets are passed the same way, via provider URIs:

dagger api call deploy --token=env://DEPLOY_TOKEN

Chain functions​

Functions interconnect into a pipeline. Each function returns an object, and the next function is called on that result:

dagger -m core api call container \
from --address=alpine \
with-exec --args=echo,hello \
stdout

Collections​

Some functions return a collection of items, such as Go packages or test files. Use keys to see the available items. Use get to select one and continue calling functions on it.

dagger check and dagger generate select collection items with flags. See Select collection items.

Output​

By default the result is printed to your terminal. Format it as JSON:

dagger api call go module --path=. generate-directories --json

Or save a returned file or directory to the host:

dagger api call build --output=./dist