-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing a dev container feature
more than once in a devcontainer.json
#44
Comments
feature
more than once in a devcontainer.json
feature
more than once in a devcontainer.json
This seems like a reasonable proposal to me and meets some of the things @edgonmsft has highlighted - @chrmarti ? |
Another option is to extend feature options, such that, they can capture arrays and objects of values. That would allow features to capture feature-global options, the list of versions and version-specific options depending on the tools they install. |
My preference is to keep it as simple as possible and not overcomplicate things. I like the proposed array syntax with the full options object inside if we are sticking with an object at the top level for the set of features. Note that this requires using the same version of the feature for each execution (E.g. {
"features": {
"devcontainers/features/node@1": {
"version": "14"
},
"devcontainers/features/node@2": {
"version": "16",
"someNewOptionInV2": "..."
}
}
} |
@chrmarti - are you suggesting features that look like this? "features": {
"devcontainers/features/[email protected]" : {
"version": [16, 14, latest]
} or equivalently with the shorthand that implies "version" "features": {
"devcontainers/features/[email protected]" : [16, 14, latest]
} How would a user modify >1 option for a given feature? I could imagine wanting a user to install a feature >1 time that uses any permutation of options. |
Yes, given the object syntax and these are two unique keys, I think we should (and would have to) support a declaration like this. |
I also the array syntax so that the whole options object can be modified for each run. The version question is an interesting one. The object syntax does allow us to use different versions since they would have different ids, although ordering will probably get interesting and the user would probably need to override it. |
For the These are the existing options today, and two plausible ways a user could configure several installations of the feature.
|
@joshspicer @edgonmsft @jkeech @chrmarti Yeah, to that point - Personally I think we're talking about two separate proposals here.
With that in mind, I'd propose we not discuss this as an "or", but rather whether we think (2) this is needed now. We clearly can see the (1) is needed at a minimum to cover cases we know about. An alternative is also that we implement both at once. |
@Chuxel I agree we may be getting side-tracked. I added a new issue to address (1) in your comment: #57 I want this proposal to focus on (2), particularly for the reason I highlighted in this comment. This is the first example I could come up with - I think this will be a more generic problem, and I think the syntax I propose is a good solution to that problem. |
If we allow for more flexibility in the options, features can handle both: multiple versions and more advanced options. Always having an object for a feature also seems to keep the schema simpler. (Not sure if the thinking was to loop over the feature's install.sh, but in general it will be more flexible and potentially less error-prone to let the feature decide how to best handle multiple versions.) The object also allows for global options, e.g., {
"features": {
"devcontainers/features/[email protected]": {
"versions": [
{
"version": "3.5",
"optimize": true
},
{
"version": "3.8",
"install_python_tools": false
}
],
"defaultVersion": "3.5",
"install_jupyterlab": true
}
}
} I think we should disallow having the same feature in multiple (feature) versions. That will make it easier for feature authors because they do not need to consider that case. |
@chrmarti how would complex objects get passed in and parsed by the install script? I think it will end up being more complicated for both end users and feature authors to deal with complex option types and instead that we should support executing a feature multiple times by looping on the outside with different sets of simple options. |
This seems simple for the end-user. For the feature we can continue to pass in a flattened list of attributes (possibly omitting the nested ones) and also include a variable with the full options JSON. I expect most features to require only simple options. |
We agree:
|
Meanwhile, is there any workaround for something like this? {
"features": {
"ghcr.io/devcontainers-contrib/features/asdf-package:1": {
"plugin": "aws-vault"
}
"ghcr.io/devcontainers-contrib/features/asdf-package:1": {
"plugin": "consul"
}
}
} |
@Alegrowin There's no workaround within the spec today to install the same Feature twice. We're exploring changing this soon with the introduction of composite/dependencies, but this exact functionality in on our backlog (although I agree it's functionality that would be very nice to have). Today, a lot of the Features in the wild wouldn't behave nicely if installed twice (either short-circuit early or overwrite existing installs). I personally don't want to introduce a solution the right guidance in place for authors to make the behavior predictable. For this example, I think a Feature that proxies to another plugin manager should naturally accept >1 plugin. For example, I think it would be nice if upstream the feature worked like so:
With Feature dependencies though, without rigid rules around options we'd still need to support the case you're illustrating above (installing the Feature twice). And I also understand that someone may want to use a Feature as-is, even if it's a bit ugly. Thanks for putting this back on our radar as useful to you. Taking this feedback back to our team. |
use workaround of devcontainers/spec#44
use workaround of devcontainers/spec#44
use workaround of devcontainers/spec#44
use workaround of devcontainers/spec#44
The current dev container features specification proposal is based on an array-like syntax for the 'features' attribute, and thus allows for the invocation of a single feature >1 with different options.
An execution goal stated in the spec is that
We are currently discussing how best to tackle feature installation order (#43), with the discussion leaning toward proceeding without use of an array, meaning that there is a need to explore other mechanisms for invoking a feature to install >1 times.
Proposal
The propose extending the value to include an array of objects.
This
devcontainer.json
will invoke thedevcontainers/features/dotnet
feature twice with two sets of options in order (first with the 3.1 set of arguments, and then 6.0 set of arguments).The text was updated successfully, but these errors were encountered: