Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aacebedo
Copy link
Contributor

@aacebedo aacebedo commented Oct 6, 2024

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)

@aacebedo
Copy link
Contributor Author

aacebedo commented Oct 8, 2024

@pascalbreuninger can you have a look please?

@pascalbreuninger
Copy link
Member

Hi @aacebedo, thanks for the PR!
I understand the desire to overwrite the base devcontainer definition and we were also thinking about this for a while.
The implemented approach here requires users to create an extra file in the source repository that then probably needs to be ignored by git to prevent users from overwriting one another

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?

@aacebedo
Copy link
Contributor Author

aacebedo commented Oct 8, 2024

Hi @aacebedo, thanks for the PR!
I understand the desire to overwrite the base devcontainer definition and we were also thinking about this for a while.
The implemented approach here requires users to create an extra file in the source repository that then probably needs to be ignored by git to prevent users from overwriting one another

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:

  • add new arguments to the command line: I was not a fan because of the complexity and the number of additional args to add to handle all sections of the file
  • add the automatic aggregation of a user file (solution implemented here)
  • add a new argument to specify an additional json file to use while calling up command: it could be a viable and more flexible solution.

What do you think of merging the two last approaches?
By default use a specifically named file located in the same dir as the devcontainer.json file AND add an optional arg to override this.
Shall we make this arg multiple value or only one?

@aacebedo aacebedo force-pushed the aacebedo/add_devcontainer_user_file branch from b174695 to d3a9bec Compare October 8, 2024 19:40
@aacebedo
Copy link
Contributor Author

aacebedo commented Oct 9, 2024

rebased on main and test E2E tests. It is now working

@pascalbreuninger
Copy link
Member

@aacebedo merging the two sounds good to me!
Something like devpod up ... --extra-devcontainer-path=$YOUR_LOCAL_FILE.
One change we might want to make is instead of merging the files literally, leverage the devcontainer specs overlaying mechanism via config.MergeConfiguration. Right now it extracts the underlying devcontainer config, i.e. from features and the base image etc, from the image and then merges the repos configuration on top.

Do you want to tackle this or should we put this on our roadmap?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants