-
Notifications
You must be signed in to change notification settings - Fork 349
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
Add support of devcontainer.user.json file #1303
base: main
Are you sure you want to change the base?
Add support of devcontainer.user.json file #1303
Conversation
@pascalbreuninger can you have a look please? |
Hi @aacebedo, thanks for the PR! If we go down that route it should probably be any devcontainer.json you have available locally without being in the same repository. What do you think? |
In fact I originally considered several approaches:
What do you think of merging the two last approaches? |
b174695
to
d3a9bec
Compare
rebased on main and test E2E tests. It is now working |
@aacebedo merging the two sounds good to me! Do you want to tackle this or should we put this on our roadmap? |
@pascalbreuninger I checked config.MergeConfiguration and I don't think it can be used. So either we say that it is not possible to override those parameters and I can modify it, or we say it is possible and then I cannot use that. |
Yep you're right. I was more referring to the overall mechanism of merging two devcontainer files that goes beyond overlaying two files. We'd need to run both devcontainer through substition, then determine a priority of image, i.e. user > default and then merge the resulting devcontainer configs. |
I hacked something by touching as less as possible to the mergeConfiguration. |
LGTM based on first glance 👍 |
OK I'll clean up and squash the fixup then. The thing that is most wanted is to be able tu customize mounts without having to modify the versionned devcontainer.json |
Okay, then that would work. One more thing we'll (you or me) have to clean up is that right now it expects paths to be present on the local fs but reads them in a place that could potentially be in a VM, leading to broken paths. I'll fix that next week |
ok I,'ll let you do it then as I am not familiar with the VM usage. Thanks |
a51dba6
to
d2d6d9a
Compare
squashed the fixup. @pascalbreuninger I let you do the checks |
@aacebedo just a quick update: I haven't forgotten about this, it's just been a bit hectic this week |
d2d6d9a
to
33bda71
Compare
ok no problem. Ive rebase on main |
@aacebedo thanks for the contribution. In general I like your implementation and think it would add value to devpod. One thing I'm not sure on though is the user file. We have |
6b420dd
to
d5e1f23
Compare
d5e1f23
to
7bd17b6
Compare
I didn't plan to make the username change. I planned to use the file as a default non versioned file that a user could add or not depending on their preference. I liked it being a special default case taken only when it exists. In a previous message @pascalbreuninger told me to keep the two approaches (devcontainer.user.json + extra paths). However if both of you prefer to only have the extra paths approach, I can remove the .user file. |
@aacebedo ah OK I can see that workflow making a lot of sense, adding the user file to a gitignore and having as a personalised override would be sweet. If @pascalbreuninger is also for it then so am I :) I think we'll have to add to the docs to make this file known to users, especially with it not being in the devcontainer spec. If it is popular with the community maybe we can look at putting upstream in the spec one day |
ping? |
This PR adds the support of an additional file named
devcontainer.user.json
or.devcontainer.user.json
.The latter is combined with the
devcontainer.json
or the.devcontainer.json
before actually building the container.It can be useful when one wants to customize the devenv of a project without modifying the file under revision (for instance when new user specific mounts shall be added to the devenv).
Note: I used an additional dep to perform the merge between the two files (mergo)