Repository navigation
Conversation
|
Yet another occasion where a dagger version constraint in |
We are going to have tracking of the version of dagger a module was initialized from in the near future. We won't immediately also have the ability to serve certain schemas to different modules based on that version, but we should be tee'd up to support that too in the medium term. In the very long term, we want all of the core functionality to be a versioned module itself, but that will take a while to come to fruition. So, I agree 😄 But in the meantime at this exact moment we still need to contend w/ issues like this. |
|
I actually had something very simple in mind: {
// ...
"daggerVersion": "0.9.*|^0.9.0|~0.9.0|^0.9.0,!0.9.3"
}If the running dagger version doesn't match that constraint, just refuse to run/evaluate the module. While I understand that modules are experimental, I assume there will be tons of other breaking changes before it becomes stable, and this would make managing those breaks easier. If the schema is going to change anyway, I see no harm in adding a field like this for the short term and then removing it once it doesn't make sense anymore. It would also make it easier for modules to express that they require a certain minimum version (for example: because they use the new constructor feature) I made my case, defense rests. 😄 |
|
Hello! Just back from vacation, will add this to my UX review list (let me know if there are other time-sensitive ones, I know there’s a RC coming up). Curious if you considered |
while reading this comment it crossed my mind the capability based security model that the kernel and WASM has (https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-overview.md) re: |
We already make |
|
I don't think there's a term that works for both the actual host and a container, for those that don't know there's a difference. We need to explain this when teaching modules much like docker users on a Mac need to understand that the host is the Linux VM running the engine, not macOS. So the best we can do (as far as choosing a word here, and other than simply documenting) is steer away from stronger associations to each side, like
+1 on the deprecation path too since it's high impact. |
Signed-off-by: Erik Sipsma <[email protected]>
|
I really like the new name! I'm all in favour of this and think that, if possible, we should do it before |
Fixes #6312
Opening this purely to have a discussion right now, the changes amount to find+replace on the
hostname right now, but not even entirely yet (need to update tests, etc.)Background
The name
Hosthas become extremely confusing in the context of modules. So far, it seems that more often than not users very reasonably assume that in a module when they usedag.Hostthey are interacting with the original "host" where the module was invoked from.However, that's not the case. They are actually interacting with the local execution environment of the module, which is the container the module is executing in.
We do want to retain this ability; being able to interact with the local execution environment of a module supports use cases like:
Whether we want to additionally support a module reading files/env vars/etc. from the caller's environment (i.e. read a file from the filesystem local to the actual CLI call) is still an open question (see discussion here), but for now we are going to continue not supporting it and just leave it open as a possibility.
Possible new names
Local(current state of this PR)Examples of usage:
Users will still need to have some understanding that modules execute in a container, not directly on the CLI's host, in order to fully grok this name and intuitively guess its behavior. However, once they know that, I think
Localmakes much more sense thanHost.dag.Host()is going back to the "host" of the CLI caller. It feels very unnatural to call a containerized execution environment "host".Local, in which case it feels much more natural to think ofLocalas referring to the local execution environment (which in the case of modules, is their container)I also like that
Localis still relatively succinct (i.e. not something even clearer but overly verbose likeCurrentExecutionEnvironment).I was concerned that
localmight be a reserved word in too many languages and thus require too much special casing everywhere, but to my surprise it doesn't appear to be a reserved word in our current SDKs.Other possible names
Some others that came to mind but I didn't go with for now are:
ExecutionEnvironmentLocal, felt too verbose to be worth itCallerHostin that it would be reasonable to assume thatCalleris referring to the CLI caller of the module (as opposed to the module itself)CurrentModuleCurrentModule, removeHostfrom module clients" section belowRenaming approaches
There's a few different ways we can go about renaming the API.
Expand
A) Just rename
Host(current state of this PR)The most straightforward is to just rename the
Hosttype to something that is more clear.This is what this PR is currently doing, specifically renaming
HosttoLocal(see "Possible new names" section above for discussion on this choice and alternatives).Pros:
Cons:
Hostbut leaving it in for a few more releases and making lots of noise about the need to update to useLocalB) Rename
Hostonly for module clientsAnother possibility would be to keep the name
Hostfor clients that are not executing in a module, but use a different name likeLocalonly for clients executing in modules.In terms of implementing this, it would be somewhat annoying but could be done entirely server-side and not require every SDK to update itself to handle this (since the server tells SDKs what schema to run codegen for). So the annoyance would be entirely internal and not so bad as to rule this out.
Pros:
Cons:
dag.Host()would incidentally have the same behavior when run outside a module and inside a module.C) Add new APIs to
CurrentModule, removeHostfrom module clientsAnother variant would be to:
Hostfrom being callable from from module sdks (but leave non-module SDKs alone)CurrentModuleAPI that allow equivalent functionality (reading files, tunneling, etc.)CurrentModulealready exists and returns theModuleobject that the current caller is executing in (error otherwise).Though I haven't worked out exactly how, in theory we could probably adjust that API such that it has the fields current present under
Hostare exposed underCurrentModule, so module code would make calls like:Pros (same as option B):
Cons:
CurrentModulestill returns aModuletype but also doesn't create a bunch of cases where non-module code tries to call i.e.dag.Directory("./whatever").AsModule().File("./some/file")and we either error out or have some sort of very confusing behaviorModuleapiMy opinion
For the sake of having a concrete starting place amongst the many possibilities, my current preference is to:
Localapi for all clients, both module and non-module. Same fields asHost, just a new name.Hostfrom module sdk codegen entirely (since backwards incompatible changes there are less painful right now)Hostin for non-module client sdks at first but marked as deprecated. Make noise about users needing to update toLocal. RemoveHostin a few releases.That feels like a good balance of not creating too much short-term pain for existing users, creating a more clear name for module users and not being overly burdensome in terms of the implementation.