From db17f542531e6c25bfb1db965dfa095b0ad7c39b Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 28 Oct 2024 14:21:56 +0200 Subject: [PATCH] build: Add devcontainer manifest for our CI image Devcontainer [1] is a popular container schema that makes IDEs and tooling aware about the container image you want to use and develop against. The most popular implementation of devcontainer are Visual Studio and VSCode and this allows us to have a out of the box pre-defined and working build environment that is very close to the environment CI runs against. This also allows VSCode on Windows and Mac to setup a Linux docker container (vm) to develop against if so desired. [1] https://containers.dev/ Part-of: --- .devcontainer/devcontainer.json | 35 ++++++++++++++++++++++++++ ci/scripts/create-subprojects-cache.sh | 5 ++++ 2 files changed, 40 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..b8903f505d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,35 @@ +{ + "name": "GStreamer Dev Toolbox", + "image": "registry.freedesktop.org/gstreamer/gstreamer/amd64/fedora:gst-toolbox-main", + "containerUser": "containeruser", + "remoteUser": "containeruser", + "postCreateCommand": ["python3", "${containerWorkspaceFolder}/ci/scripts/handle-subprojects-cache.py" ,"--cache-dir", "/subprojects", "subprojects/"], + "privileged": false, + "capAdd": [ "SYS_PTRACE" ], + "customizations": { + "vscode": { + "settings": { + "files.watcherExclude": { + "**/target/**": true + }, + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff" + } + }, + "extensions": [ + "charliermarsh.ruff", + "GitLab.gitlab-workflow", + "mesonbuild.mesonbuild", + "ms-python.mypy-type-checker", + "ms-python.pylint", + "ms-python.python", + "ms-vscode.cpptools", + "redhat.vscode-xml", + "redhat.vscode-yaml", + "rust-lang.rust-analyzer", + "tamasfe.even-better-toml", + "vadimcn.vscode-lldb" + ] + } + } +} diff --git a/ci/scripts/create-subprojects-cache.sh b/ci/scripts/create-subprojects-cache.sh index 1a174c556b..82571f3bce 100644 --- a/ci/scripts/create-subprojects-cache.sh +++ b/ci/scripts/create-subprojects-cache.sh @@ -8,5 +8,10 @@ git -C /gstreamer submodule update --init --depth=1 meson subprojects download --sourcedir /gstreamer ./ci/scripts/handle-subprojects-cache.py --build --cache-dir /subprojects /gstreamer/subprojects/ +# Avoid the cache being owned by root +# and make sure its readable to anyone +chown containeruser:containeruser --recursive /subprojects/ +chmod --recursive a+r /subprojects/ + # Now remove the gstreamer clone rm -rf /gstreamer