Thoughts on devcontainers for VyOS repos?

I am farting around in the different repos trying to do some work and find it a bit difficult to know how to build in the different repos having now worked through python, c, c++, and ocaml repos.

Would there be oposition to adding a .devcontainer and .vscode directory to repos in general?
My instinct is to base the devcontainer on vyos-build container at least for now as that is being used to build in general, then add packages or what ever is needed in the Dockerfile and for what has to be run in a container with the repo mounted a Makefile target called deps.

You can have a quick look at I am currently thinking, this is in no way final just what I have for now in this one repo: libvyosconfig0: T5083 Create initial devcontainer config · thomasfinstad/vyos1x-config@f133216 · GitHub

The advantage of doing this as I can see:

  • Declarative environments to work in
  • Much lower barrier to entry for those that wish to contribute
  • Far less reliance on documentation as the environments will be documented in the containers + scripts in each repo
  • Ensure everyone have the option to work within a similar environment
  • Multi IDE support: Supporting tools and services and for those that prefer vim it can simply be used from within the container as normal.

Disadvantages:

  • For those that do not like to use docker during development it could be possible to forget to add new packages / dependencies to the correct place if they are installed on the local system. This problem exists as is already though.
  • Docker/podman can at times be fiddly to configure correctly.

Edit:
I want to add that I believe in keeping 1 environment when possible, so if the idea of adding devcontainers to repos is not offensive to anyone I would suggest baking in as much of the dependency installation into the base container as possible, this would make it so CI testing & building and the development environments stay in sync, reducing problems of either side not behaving as expected when something is changed / updated etc.

I might be slow today :slight_smile:

But what is the TLDR/ELI5 edition of this proposal vs how its done today without these directories?

Edit:
I realized you probably wanted to know what this does, not why I want it hehe.

So devcontainers is a way to connect your IDE to a container, meaning that all the tools and binaries that are installed in the container will be available to your IDE. This makes it possible to share a very precise setup for developing. This means the IDE will be able to take advantage of things such as having local debugging and other features without having to make sure your local system has the correct version of this or that. Example: local debugging of python with the python version installed in the container, decoupling your system, and the package versions provided by your distro, from the development requirements. It also means you do not have to install a bajillion different tools in your machine if you wish your IDE to work with them smoothly. While it is possible (at least with vscode) to manually connect your IDE to the container and work, devcontainers just makes this easier and standardized.

Original:

Maybe it is a bit hard to get across, but the goal was not to depreciate / change the current workflow for anyone that wishes to keep it, but to enable others (including me) to have a simpler way to join in on contributing. This would make IDEs compatible with devcontainers far nicer to work in.

I also wish to investigate creating a section in the READMEs for the repos getting devcontainers that has a very simple “how to build” section for users of the devcontainers, as well as some “flowcharts” for the docs.vyos.io that can help people understand how the build process takes packages from where, as well as how internal tools / systems communicate during execution of commands.

My ultimate goal with all this is that I found it incredibly heavy to attempt any real changes myself, and while I am not a developer by trade I was surprised by how difficult it was to help out and wish to make the process easier for myself and others.

I will probably need help with some of these things, but I am willing to put in some effort and do the work as I think VyOS can get more contribution if we can lower the barrier to entry and grow the community as a whole.

1 Like

@Apachez did my last edit make it any clearer or is it still confusing what benefits this would/could bring? I apologize if I have not been able to make it clear.

This shows a bit about devcontainers, it is a bit slow so if you wish to watch it you might want to increase the playback speed https://www.youtube.com/watch?v=dihfA7Ol6Mw