Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[proposal] Update the
devcontainer.json
schema to be able to represent a 'mergedConfiguration' #206base: main
Are you sure you want to change the base?
[proposal] Update the
devcontainer.json
schema to be able to represent a 'mergedConfiguration' #206Changes from 7 commits
c1224a4
3a3e262
4ab251e
9e26125
3a62b33
a778863
aa048eb
465381d
56b107c
1dc72c9
452b918
b19219f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this means that a
devcontainer-feature.json
could specify something like:Should it be considered an error if a
devcontainer-feature.json
specifies a list of objects? Should tools ignore an$origin
property when reading from a json file directly (versus from image metadata)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this change specifically affects the schema for
devcontainer.json
, I see. I hadn't realized thatdevcontainer-feature.json
has a distinct json schema.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I don't think we'd want to update the
devcontainer-feature.json
schema, which is very close to adevcontainer.json
but distinct. The goal of the$
properties as members of thedevcontainer.json
is so that a command such asdevcontainer read-configuration
can output a json object that is also a devcontainer.json. That's not the case today without these changes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking more about this, and I'm not sure that's a good thing to have in the spec itself...it seems like an implementation detail for the specific tool in question. The way some of the other comments read indicates that it'd be "valid" in a
devcontainer.json
but not actually used (re: a comment above about$entrypoints
)...which kind of implies that the output ofread-configuration
is not actually adevcontainer.json
.That is, it seems like a "proper" implementation would use this schema to encode/decode metadata stored in the image label, and use it internally as the result of merging all of the various metadata sources, but it's not actually valid
devcontainer.json
config. Effectively splitting out merged metadata into a separate schema and leaving the existingdevcontainer.json
anddevcontainer-feature.json
alone.The way I've been thinking about it lately is that a
*.json
contains two sets of data: config and metadata. I parse eitherdevcontainer.json
ordevcontainer-feature.json
intoConfig
orFeatureConfig
respectively, plus aMetadata
entry. I parse the image label into aMergedMetadata
entry. Internally I store the config and the merged metadata to drive the build process. I use the merged metadata to render into an image label. I print the config and merged metadata during debug output as two separate entities.edit: The main reason I'm bringing this up is because it seems to me that this change may require significant explanation in the docs to reduce confusion for implementors vs declaring it as a distinct schema and indicating that it represents the results of the "merge logic table" and should be used as the entry for the
devcontainer.metadata
image label.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would
$origin
be the qualified feature id with the version ORdevcontainer.json
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have Feature dependencies and may have more than one Feature contributing configuration, we should use the "canonical ID" (for OCI Features, expanded with the SHA hash).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although i'm going back and forth here. At the end of the day, the intention I have for
$origin
is to make it easier to understand from the logs what is happening. It may be more intuitive to print verbatim what is in thedevcontainer.json
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the
$origin
of a bit of config that comes from thedevcontainer.metadata
image label (assuming it doesn't carry one already)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a section of metadata in
devcontainer.metadata
doesn't already have an$origin
, we wouldn't anything. It had to come from somewhere (either a base dev container that defined the image, a Feature, or the user's current dev container). If omitted, we don't have any insight into where it came from and we'd need to log something generically in those cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok with users including this in their devcontainer.json? I guess we might see this if we don't add a regular entrypoint property.
We don't have the
$origin
here which would make sense for consistency.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok. I don't think we'll necessarily do anything with this value if it's in a
devcontainer.json
as input, right? The source of truth is still in the image label - this section of the spec is as a standardized output forread-configuration
. I imagine all the$
are ignored during a build and used by humans/loggers.