Repository navigation
Description
Context
Dagger has a feature called inputs and outputs. Any field can be annotated with the Cue attributes @dagger(input) or @dagger(output). This serves several purposes:
-
Identify data produced and consumed by a Dagger environment at runtime. Fields marked as inputs may receive data from external sources. Fields marked as outputs may be sent to external consumers.
-
Provide missing information about the "call convention" of a Cue definition. Just like a Go function has arguments and return values, a Cue definition has input fields and output fields. Cue does not differentiate between them, so
dagger docuses input and output annotations to generate more useful package documentation.
Problem
The inputs/outputs feature is a common source of confusion for several reasons:
-
It serves several different purposes, so it's difficult to explain and to understand.
-
It makes the package development experience worse. Manually setting the cue attributes is repetitive and error-prone; Forgetting or mistyping attributes will silently break the docs; everything is more verbose; more concepts to learn even for a basic package.
-
It makes the end-user experience worse. Package developers (who set the input/output attributes) don't know which fields will actually be consumed or produced by external sources in a given environment. And
daggercan't accurately detect them either. The result is that all fields with@dagger(input)are listed bydagger input list. This makes the input discovery feature unusable on larger configurations.
Solution
NOTE: this solution depends on the environment schema proposal.
Solution
- Deprecate
@dagger(input)and@dagger(output), and the helpersdagger.#Inputanddagger.#Output - Each environment may define an input and output schema, by setting the
inputandoutputfields in the environment schema. - Leave out of scope the problem of auto-documenting input and output fields in packages. This is better solved upstream by Cue.
Example:
package acme
import (
"alpha.dagger.io/dagger"
)
// A complete dev environment for the ACME application
#AcmeDevEnv: dagger.#Environment & {
name: "acme-dev"
description: "A complete dev environment for the ACME application"
input: {
git: {
// Address of the git repository
remote: string | *"https://github.com/acme/acme"
// Git auth
ssh: privateKey: dagger.#Secret
https: {
username: string
password: dagger.#Secret
}
}
}
output: url: "https://\(dag.hostname)"
// Internal DAG configuration
dag: {
repo: git.#Repository & {
remote: input.git.remote
auth: sshKey: input.git.ssh.privateKey
}
app: netlify.#Site & {
// ...
}
}
}
Activity
[-]WIP: Connectors: a simpler alternative to inputs & outputs[/-][+]WIP: simplify inputs and outputs[/+][-]WIP: simplify inputs and outputs[/-][+]Simplify inputs and outputs[/+]shykes commentedon Sep 15, 2021
I narrowed down the scope significantly, to make this a more incremental improvement.
cc @aluzzardi @samalba @grouville @talentedmrjones @TomChv
aluzzardi commentedon Feb 1, 2022
@shykes Is this already covered by Europa's
#Plan?