Replies: 2 comments 5 replies
-
Yes this is a great summary of the general technical direction Andrea and I have been talking about (and that I've been starting to document but then getting caught up in implementation stuff the last few days). One interesting distinction you make here though is that
We currently call this cloak/api/schema/schema.graphql Line 42 in cecd88e The appeal of "import" and "package" to me is that it cues the equivalent concepts from programming languages and dependency management, but that also may be a product of my own biases. Replacing "package" with "extension" or "plugin" seems entirely reasonable too.
Yes you can see the current (very rough, informally defined) version of this here:
But now that the switch to the new resolver model is done (which impacted this a lot), it's definitely time to start formally defining this (and cleaning up the current implementation, which is a bit hacky in places). That will make it much easier to start adding new runtimes more quickly. Overall, were definitely on the same page here. We should discuss more and then I'll incorporate this into the |
Beta Was this translation helpful? Give feedback.
-
First attempt at documenting cloak concepts (and implicitly the architecture) which begins to incorporate some of the ideas from this discussion: https://github.com/dagger/cloak/blob/e37ac84ea39af13d1c45f5923eef339edbf5903b/docs/concepts.md I said before in this discussion that what you described here was the direction we were going, but then as I wrote the doc and thought about it more I realized that "full" api-centricity was more than I was originally imagining. Taken to its logical extreme there are lots of things I previously assumed would be baked into cloak that actually could be modeled as extensions. For example, in the doc I wrote stubbers are extensions, SDKs are actually just extensions which can create new extensions, etc. But the design in my head (and sort of implied in the doc) currently still hardcodes the "runtime protocol" into cloak and assumes all resolvers "speak it" even though that too could probably be an extension in theory. I agree with Andrea's point made in separate discussions that taking the api-centricity to the absolute extreme where Overall, on a product level we can absolutely still decide to take this api-centric approach where |
Beta Was this translation helpful? Give feedback.
-
A thought experiment. What if:
cloak is purely an API server, packaged as a low-level plumbing tool. No client functionality; no config file; only the bare minimum command-line flags to setup the server, eg. listening address, loglevel.. All configuration is done via the graphql API itself, including loading API extensions (see other points)
cloakctl could be a companion low-level client tool, similar to buildctl. Since everything is done via graphql, it's really a glorified curl with some conveniences baked in.
dagger would add a porcelain layer that instruments cloak and adds a nice UX and DX. For example the concept of a project, and corresponding config file; any sort of versioning and package management; universe of extensions; SDKs; a complete CLI experience; interactive development sandbox; etc.
Because our engine would purely be an API server, our DX would be API-centric. A central concept would be API extensions, which as the name implies, extend the Dagger API with custom features: actions, artifact streams, services, etc. Under the hood this would be powered by cloak's API extension feature.
Cloak API extensions would be loaded by invoking the special method FS { LoadExtension { Install } }. Or something like that... Basically an extension could be loaded from any FS that complies with the extension ABI.
To develop a cloak API extension, one must produce a FS that implements the extension ABI. The extension ABI is a spec that describes what cloak needs to run an extension. The spec is pretty simple and defines things like:
- A valid graphql schema must be present at /cloak/schema.sql
- the graphql schema must match the following schema: ...
- a runnable entrypoint must be present at /cloak/run-extension
- entrypoint will be executed with the root of the extension bundle as its rootfs
- the following env variables will be set: ....
- input data will be written to stdin in json
- output data must be written to stdout in json
- exit code 0 indicates success. If exit code is an error, errors should be written to stderr in json event stream format. The following json fields have special meaning: ...
- etc.
Importantly, Cloak does not define how to build an extension. That is a higher-level concern. Client is responsible for procuring extensions (by building them or downloading them), then loading them from any FS in cloak.
Dagger adds a whole layer of SDKs, code generation and build tools to make it very easy to create these extensions
Possibly, even the current project would be built and run in the same way: from cloak's point of view, it would just be another API extension... Except it would be built from the current local directory, and loaded under todoapp instead of netlify or yarn. Makes no difference to cloak.
I like the idea of telling devops engineers: "you are developing an API". This reminds me of Airtable, where each database has its own API endpoint and generated API docs. So you're not so much using "the Airtable API" as "my food recipe database API powered by Airtable". I think we could copy this concept here. You're not using the Dagger API, you're using the Acme Corp devops API, powered by Dagger. And here are the API docs and generated clients for it.
--> From a technical point of view I suspect this will feel almost identical to what you guys are already seeing and how you see the code working. But at the same time it paints an end-to-end picture that I wasn't seeing before, and that I find very exciting because I see how we can explain it, and what the user experience might look like.
Beta Was this translation helpful? Give feedback.
All reactions