Repository navigation
Replies: 2 comments 1 reply
|
Overall I like it, it's more explicit (for instance: referencing the However we should be careful with root definitions: For example, instead of: I would do: Without it, |
0 replies
|
Given (Maybe it allows to differentiate 2 pipelines in cue by their list of Ops. Example: |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Intro
In its current state, this is more of a brain dump with a straw man proposal rather than a full fledged proposal. Just enough to get some ideas bouncing.
Background
Currently, the concept of computation (e.g. a set of compute operations) and data (e.g. the resulting filesystem from the computation) are mixed together as a single concept,
dagger.#Artifactwith an open definition:Packages expecting data as input actually take a computational pipeline (in the form of an
#Artifactwith accompanying#upinstructions). At runtime, the artifact is computed and replaced by the resulting buildkit state (e.g. filesystem).For instance,
docker.#Buildis defined as such:If we were to pass a
git.#Repositoryas thesourceargument, it would eventually CUE evaluate to something like this:As soon as
#Buildattempts to manipulatesource(for instance, copying its content), dagger will compute the pipeline on the fly (i.e.#FetchGitoperation) and use the resulting filesystem.Access to local directories (e.g.
dagger input dir) works in the same way and is "compiled" to an artifact:Problem
#Artifactconcept is not intuitive as it serves different purposes (compute and data).mounttakes an#Artifactwhich itself providesmountwhich itself provides an#Artifact, ...) have caused various performance issues. This led to all#Artifactreferences being replaced by_as a workaround. Related performance issues keep coming up [reference needed -- @samalba @grouville?]{ ... _ }) of#Artifactcauses problems. Since anything is technically an artifact, it confuses CUE's type system (e.g.if (source & string) != _|_). Passing a wrong argument (or forgetting to provide it) causes hard to understand CUE errors [reference needed -- @samalba?]docker.#Loadas well). In a nutshell:always: truewhich is re-computed at each reference Duplicate execution withalways: true#42)Proposal
WIP
#Artifactinto computation (#Pipeline?) and data (#Directory?)source: #Directory) rather than computation{ ... _})Directory (data)
idfield is there to help the runtime perform the mapping, it's an implementation detail#Directorydirectly (e.g.source: dagger.#Directory). This is true for built-in definitions as well (e.g.#Exec: { mount: [string]: dagger.#Directory })dagger input dir) maps to a#Directory. It's the job of the runtime to figure out how solve the mapping.Pipeline (computation)
WIP
#Artifacts (e.g.#upinstructions are executed)fsis the bridge with#Directory... _Example:
Exporting
WIP
Beside filesystem contents, computation pipelines are passed around for their exported values.
With the current
#Artifactit looks like this:#Pipelineto be closedfsfield (e.g. can't be both astringand containfs)One potential solution would be to adopt the pattern of
os.#Container: there's no built-in export, exporting happens from the filesystem instead.Example:
User-facing Directories (integration with #1058)
Splitting computation and data breaks the current way of injecting user directories using
op.#Localin an#Artifact. It's a happy coincidence since that method doesn't play very nice with #1058 IMO (/cc @talentedmrjones).A better approach would be "declarative format" for directories:
context.directories#Directory(with theidand such). No need for anop.#Localcontext.directoriescan be passed around in packagesThere are a couple alternative DX here:
Merging
Use the same
#Directorydefinition both for "produced" directories and "user defined" directories. This is achieved by merging the base#Directoryfields with additional (optional) user-settable fields.Example definition:
Example of a plan:
#Directorytypepath) which will be ignored if set outside ofcontext.directories. Can be confusing to have fields which you're not supposed to set.Wrapping
Here we keep the original
#Directoryand add a new definition specifically meant to be used in context. This new definition wraps#DirectoryExample definition:
Example of a plan:
#Directoryone is supposed to fill or not#LocalDirectorywe could have#SSHDirectorywith entirely different fields.dagger.#Secretandcontext.#AWSVaultSecret,context.#SOPSSecret, ...) and services (e.g.dagger.#Streamandcontext.#UnixSocket,context.#TCPSocket). Merging would require cramming every option into a single type.#LocalDirectory) are only relevant to the runtime to compute a universal type (#Directory). If a package uses an old version of#Directoryit shouldn't prevent the plan to use a new contextual type (e.g.#AWSVaultSecret).context.directories.xxx.contentsis a bit cumbersomeEmbedding
I'm not sure if this would work.
This is a hybrid between merging and wrapping.
Example definition:
Example of a plan:
context.directories.xxx.contentssyntax (e.g.context.directories.xxxworks)All reactions