From c5f8b02b0d1f6dc6b50d4b9d4e723fbfac9de85e Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Sat, 7 Dec 2024 19:35:43 -0800 Subject: [PATCH 1/2] remove --- .devcontainer/.gitignore | 3 -- .devcontainer/Dockerfile | 18 --------- .devcontainer/container_post_create.sh | 38 ------------------ .devcontainer/container_post_start.sh | 15 ------- .devcontainer/devcontainer.json | 53 ------------------------- .devcontainer/host_setup | 47 ---------------------- .devcontainer/host_setup.cmd | 10 ----- .github/workflows/tools_tests.yaml | 54 -------------------------- release/release_files.py | 1 - tools/README.md | 12 +----- 10 files changed, 1 insertion(+), 250 deletions(-) delete mode 100644 .devcontainer/.gitignore delete mode 100644 .devcontainer/Dockerfile delete mode 100755 .devcontainer/container_post_create.sh delete mode 100755 .devcontainer/container_post_start.sh delete mode 100644 .devcontainer/devcontainer.json delete mode 100755 .devcontainer/host_setup delete mode 100644 .devcontainer/host_setup.cmd delete mode 100644 .github/workflows/tools_tests.yaml diff --git a/.devcontainer/.gitignore b/.devcontainer/.gitignore deleted file mode 100644 index 5682fe1190e970..00000000000000 --- a/.devcontainer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.Xauthority -.env -.host/ \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 53a06f6f31db77..00000000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM ghcr.io/commaai/openpilot-base:latest - -RUN apt update && apt install -y vim net-tools usbutils htop ripgrep tmux wget mesa-utils xvfb libxtst6 libxv1 libglu1-mesa gdb bash-completion -RUN python3 -m ensurepip --upgrade -RUN pip3 install ipython jupyter jupyterlab - -RUN cd /tmp && \ - ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \ - curl -L -o virtualgl.deb "https://github.com/VirtualGL/virtualgl/releases/download/3.1.1/virtualgl_3.1.1_$ARCH.deb" && \ - dpkg -i virtualgl.deb - -RUN usermod -aG video batman - -USER batman - -RUN cd $HOME && \ - curl -O https://raw.githubusercontent.com/commaai/agnos-builder/master/userspace/home/.tmux.conf && \ - curl -O https://raw.githubusercontent.com/commaai/agnos-builder/master/userspace/home/.vimrc diff --git a/.devcontainer/container_post_create.sh b/.devcontainer/container_post_create.sh deleted file mode 100755 index dee1c611018bad..00000000000000 --- a/.devcontainer/container_post_create.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -TARGET_USER=batman -source .devcontainer/.host/.env - -# override display flag for mac hosts -if [[ $HOST_OS == darwin ]]; then - echo "Setting up DISPLAY override for macOS..." - cat <> /home/$TARGET_USER/.bashrc -source .devcontainer/.host/.env -if [ -n "\$HOST_DISPLAY" ]; then - DISPLAY_NUM=\$(echo "\$HOST_DISPLAY" | awk -F: '{print \$NF}') - export DISPLAY=host.docker.internal:\$DISPLAY_NUM -fi -EOF -fi - -# setup virtualgl for mac hosts -if [[ $HOST_OS == darwin ]]; then - echo "Setting up virtualgl for macOS..." - cat <> /home/$TARGET_USER/.bashrc -if [ -n "\$HOST_DISPLAY" ]; then - export VGL_PORT=10000 - export VGL_CLIENT=host.docker.internal - export VGL_COMPRESS=rgb - export VGL_DISPLAY=:99 - export VGL_FPS=60 - # prevent vglrun from running exec - alias exec=:; source vglrun :; unalias exec -fi -EOF -fi - -# These lines are temporary, to remain backwards compatible with old devcontainers -# that were running as root and therefore had their caches written as root -sudo chown -R $TARGET_USER: /tmp/scons_cache -sudo chown -R $TARGET_USER: /tmp/comma_download_cache -sudo chown -R $TARGET_USER: /home/batman/.comma diff --git a/.devcontainer/container_post_start.sh b/.devcontainer/container_post_start.sh deleted file mode 100755 index 1521b9c3fb4c30..00000000000000 --- a/.devcontainer/container_post_start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -source .devcontainer/.host/.env - -# setup safe directories for submodules -SUBMODULE_DIRS=$(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') -for DIR in $SUBMODULE_DIRS; do - git config --global --add safe.directory "$PWD/$DIR" -done - -# virtual display for virtualgl -if [[ "$HOST_OS" == "darwin" ]] && [[ -n "$HOST_DISPLAY" ]]; then - echo "Starting virtual display at :99 ..." - tmux new-session -d -s fakedisplay Xvfb :99 -screen 0 1920x1080x24 -fi diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 3f5b38d12ea0d1..00000000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "openpilot devcontainer", - "build": { - "dockerfile": "Dockerfile" - }, - "postCreateCommand": ".devcontainer/container_post_create.sh", - "postStartCommand": ".devcontainer/container_post_start.sh", - "initializeCommand": [".devcontainer/host_setup"], - "privileged": true, - "containerEnv": { - "DISPLAY": "${localEnv:DISPLAY}", - "PYTHONPATH": "${containerWorkspaceFolder}", - "TERM": "xterm-256color", - "force_color_prompt": "1" - }, - "runArgs": [ - "--volume=/dev:/dev", - "--volume=/tmp/.X11-unix:/tmp/.X11-unix", - "--volume=${localWorkspaceFolder}/.devcontainer/.host/.Xauthority:/home/batman/.Xauthority", - "--volume=${localEnv:HOME}/.comma:/home/batman/.comma", - "--volume=${localEnv:HOME}/.azure:/home/batman/.azure", - "--volume=/tmp/comma_download_cache:/tmp/comma_download_cache", - "--shm-size=1G", - "--add-host=host.docker.internal:host-gateway", // required to use host.docker.internal on linux - "--publish=0.0.0.0:8070-8079:8070-8079" // body ZMQ services - ], - "features": { - "ghcr.io/devcontainers/features/common-utils:2": { - "installZsh": false, - "installOhMyZsh": false, - "upgradePackages": false, - "username": "batman" - }, - "ghcr.io/devcontainers-contrib/features/gh-cli:1": {}, - "ghcr.io/devcontainers/features/azure-cli:1": {} - }, - "containerUser": "batman", - "remoteUser": "batman", - "customizations": { - "vscode": { - "extensions": [ - "ms-python.python", - "ms-vscode.cpptools", - "ms-toolsai.jupyter", - "guyskk.language-cython", - "lharri73.dbc" - ] - } - }, - "mounts": [ - "type=volume,source=scons_cache,target=/tmp/scons_cache" - ] -} diff --git a/.devcontainer/host_setup b/.devcontainer/host_setup deleted file mode 100755 index 8ff81ebe421b6b..00000000000000 --- a/.devcontainer/host_setup +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# pull base image -if [[ -z $USE_LOCAL_IMAGE ]]; then - echo "Updating openpilot_base image if needed..." - docker pull ghcr.io/commaai/openpilot-base:latest -fi - -# setup .host dir -mkdir -p .devcontainer/.host - -# setup links to Xauthority -XAUTHORITY_LINK=".devcontainer/.host/.Xauthority" -rm -f $XAUTHORITY_LINK -if [[ -z $XAUTHORITY ]]; then - echo "XAUTHORITY not set. Fallback to ~/.Xauthority ..." - if ! [[ -f $HOME/.Xauthority ]]; then - echo "~/.XAuthority file does not exist. GUI tools may not work properly." - touch $XAUTHORITY_LINK # dummy file to satisfy container volume mount - else - ln -sf $HOME/.Xauthority $XAUTHORITY_LINK - fi -else - ln -sf $XAUTHORITY $XAUTHORITY_LINK -fi - -# setup host env file -HOST_INFO_FILE=".devcontainer/.host/.env" -SYSTEM=$(uname -s | tr '[:upper:]' '[:lower:]') -echo "HOST_OS=\"$SYSTEM\"" > $HOST_INFO_FILE -echo "HOST_DISPLAY=\"$DISPLAY\"" >> $HOST_INFO_FILE - -# run virtualgl if macos -if [[ $SYSTEM == "darwin" ]]; then - echo - if [[ -f /opt/VirtualGL/bin/vglclient ]]; then - echo "Starting VirtualGL client at port 10000..." - VGL_LOG_FILE=".devcontainer/.host/.vgl/vglclient.log" - mkdir -p "$(dirname $VGL_LOG_FILE)" - /opt/VirtualGL/bin/vglclient -l "$VGL_LOG_FILE" -display "$DISPLAY" -port 10000 -detach - else - echo "VirtualGL not found. GUI tools may not work properly. Some GUI tools require OpenGL to work properly. To use them with XQuartz on mac, VirtualGL needs to be installed. To install it run:" - echo - echo " brew install --cask virtualgl" - echo - fi -fi diff --git a/.devcontainer/host_setup.cmd b/.devcontainer/host_setup.cmd deleted file mode 100644 index 885bd27f2568ec..00000000000000 --- a/.devcontainer/host_setup.cmd +++ /dev/null @@ -1,10 +0,0 @@ -:: pull base image -IF NOT DEFINED USE_LOCAL_IMAGE ^ -echo "Updating openpilot_base image if needed..." && ^ -docker pull ghcr.io/commaai/openpilot-base:latest - -:: setup .host dir -mkdir .devcontainer\.host - -:: setup host env file -echo "" > .devcontainer\.host\.env \ No newline at end of file diff --git a/.github/workflows/tools_tests.yaml b/.github/workflows/tools_tests.yaml deleted file mode 100644 index 493671051fbd15..00000000000000 --- a/.github/workflows/tools_tests.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: tools - -on: - push: - branches: - - master - pull_request: - workflow_call: - inputs: - run_number: - default: '1' - required: true - type: string -concurrency: - group: tools-tests-ci-run-${{ inputs.run_number }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }} - cancel-in-progress: true - -env: - BASE_IMAGE: openpilot-base - DOCKER_LOGIN: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} - - BUILD: selfdrive/test/docker_build.sh base - - RUN: docker run --shm-size 2G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c - - -jobs: - devcontainer: - name: devcontainer - runs-on: ubuntu-latest - if: false # we can re-enable once this is faster - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - uses: ./.github/workflows/setup-with-retry - - name: Use local image for testing devcontainer with latest base image - run: | - echo "USE_LOCAL_IMAGE=true" >> "$GITHUB_ENV" - - name: Setup Dev Container CLI - run: npm install -g @devcontainers/cli - - name: Build dev container image - run: ./scripts/retry.sh devcontainer build --workspace-folder . - - name: Run dev container - run: | - mkdir -p /tmp/devcontainer_scons_cache/ - cp -r $GITHUB_WORKSPACE/.ci_cache/scons_cache/. /tmp/devcontainer_scons_cache/ - devcontainer up --workspace-folder . - - name: Test environment - run: | - devcontainer exec --workspace-folder . scons -j$(nproc) cereal/ common/ - devcontainer exec --workspace-folder . pip3 install pip-install-test - devcontainer exec --workspace-folder . touch /home/batman/.comma/auth.json - devcontainer exec --workspace-folder . sudo touch /root/test.txt diff --git a/release/release_files.py b/release/release_files.py index afd0d468b67adc..52974ba7113a13 100755 --- a/release/release_files.py +++ b/release/release_files.py @@ -32,7 +32,6 @@ ".git/", ".github/", - ".devcontainer/", "Darwin/", ".vscode", diff --git a/tools/README.md b/tools/README.md index 7f5c6b4d06df06..9cadf645c64133 100644 --- a/tools/README.md +++ b/tools/README.md @@ -4,7 +4,7 @@ openpilot is developed and tested on **Ubuntu 24.04**, which is the primary development target aside from the [supported embedded hardware](https://github.com/commaai/openpilot#running-on-a-dedicated-device-in-a-car). -Running natively on any other system is not recommended and will require modifications. On Windows you can use WSL, and on macOS or incompatible Linux systems, it is recommended to use the dev containers. +Most of openpilot should work natively on macOS. On Windows you can use WSL. Running natively on any other system is not recommended and will require modifications. ## Native setup on Ubuntu 24.04 @@ -48,16 +48,6 @@ source .venv/bin/activate scons -u -j$(nproc) ``` -## Dev Container on any Linux or macOS - -openpilot supports [Dev Containers](https://containers.dev/). Dev containers provide customizable and consistent development environment wrapped inside a container. This means you can develop in a designated environment matching our primary development target, regardless of your local setup. - -Dev containers are supported in [multiple editors and IDEs](https://containers.dev/supporting), including Visual Studio Code. Use the following [guide](https://code.visualstudio.com/docs/devcontainers/containers) to start using them with VSCode. - -#### X11 forwarding on macOS - -GUI apps like `ui` or `cabana` can also run inside the container by leveraging X11 forwarding. To make use of it on macOS, additional configuration steps must be taken. Follow [these](https://gist.github.com/sorny/969fe55d85c9b0035b0109a31cbcb088) steps to setup X11 forwarding on macOS. - ## WSL on Windows [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/about) should provide a similar experience to native Ubuntu. [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/compare-versions) specifically has been reported by several users to be a seamless experience. From cf8e9923bb256eb9423f2296fe81262c877cfa0c Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Sat, 7 Dec 2024 20:34:38 -0800 Subject: [PATCH 2/2] Update tools/README.md Co-authored-by: Adeeb Shihadeh --- tools/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/README.md b/tools/README.md index 9cadf645c64133..ce710d5032d67f 100644 --- a/tools/README.md +++ b/tools/README.md @@ -4,7 +4,7 @@ openpilot is developed and tested on **Ubuntu 24.04**, which is the primary development target aside from the [supported embedded hardware](https://github.com/commaai/openpilot#running-on-a-dedicated-device-in-a-car). -Most of openpilot should work natively on macOS. On Windows you can use WSL. Running natively on any other system is not recommended and will require modifications. +Most of openpilot should work natively on macOS. On Windows you can use WSL for a nearly native Ubuntu experience. Running natively on any other system is not currently recommended and will likely require modifications. ## Native setup on Ubuntu 24.04