From 95ec89668c932a5140f840d15127b2a12d75f621 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Thu, 12 Oct 2023 17:49:15 -0500 Subject: [PATCH 1/3] Cleaned up Docker pipelines (#121) * Cleaned up Dockerfile and added new user entrypoints * Fixed robot pipeline to support building for arm64 * Updated devcontainer configurations to use latest changes * Testing pipelines * Removed testing branch from pipelines * Precommit * Resolved pr comments (cherry picked from commit 11807c8e7e5a19faf4b136d9b8c35458338a0fe9) # Conflicts: # .devcontainer/nouveau/devcontainer.json # .devcontainer/nvidia/devcontainer.json # .github/ISSUE_TEMPLATE/config.yaml # .github/workflows/ci.yaml --- .devcontainer/nouveau/Dockerfile | 26 +++ .devcontainer/nouveau/devcontainer.json | 17 +- .devcontainer/nvidia/Dockerfile | 26 +++ .devcontainer/nvidia/devcontainer.json | 17 +- .docker/Dockerfile | 284 ++++++++---------------- .docker/compose/nouveau-desktop.yaml | 20 ++ .docker/compose/nvidia-desktop.yaml | 30 +++ .docker/entrypoints/dev.sh | 7 - .docker/entrypoints/sim.sh | 10 +- .dockerignore | 1 + .github/ISSUE_TEMPLATE/config.yaml | 5 + .github/workflows/ci.yaml | 10 +- .github/workflows/docker.yaml | 131 ++++++++++- 13 files changed, 366 insertions(+), 218 deletions(-) create mode 100644 .devcontainer/nouveau/Dockerfile create mode 100644 .devcontainer/nvidia/Dockerfile create mode 100644 .docker/compose/nouveau-desktop.yaml create mode 100644 .docker/compose/nvidia-desktop.yaml delete mode 100644 .docker/entrypoints/dev.sh diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile new file mode 100644 index 00000000..d04fce29 --- /dev/null +++ b/.devcontainer/nouveau/Dockerfile @@ -0,0 +1,26 @@ +FROM ghcr.io/robotic-decision-making-lab/blue:rolling-desktop + +# Install ROS dependencies +# This is done in a previous stage, but we include it again here in case anyone wants to +# add new dependencies during development +ENV USERNAME=blue +ENV USER_WORKSPACE=/home/$USERNAME/ws_blue +WORKDIR $USER_WORKSPACE + +COPY --chown=$USER_UID:$USER_GID . src/blue +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && rosdep update \ + && rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --skip-keys="gz-transport12 gz-sim7 gz-math7 gz-msgs9 gz-plugin2" \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* + +# Install debugging/linting Python packages +COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . +RUN python3 -m pip install -r requirements-dev.txt \ + && rm -rf requirements-dev.txt + +# Disable the setuputils installation warning +# This prevents us from needing to pin the setuputils version (which doesn't always work) +ENV PYTHONWARNINGS="ignore" diff --git a/.devcontainer/nouveau/devcontainer.json b/.devcontainer/nouveau/devcontainer.json index 521dcce7..ab37a7a3 100644 --- a/.devcontainer/nouveau/devcontainer.json +++ b/.devcontainer/nouveau/devcontainer.json @@ -1,6 +1,8 @@ { - "dockerFile": "../../.docker/Dockerfile", + "name": "Blue Nouveau Dev Container", + "dockerFile": "Dockerfile", "context": "../..", +<<<<<<< HEAD "build": { "args": { "WORKSPACE": "${containerWorkspaceFolder}", @@ -8,6 +10,10 @@ }, "target": "develop" }, +======= + "workspaceMount": "source=${localWorkspaceFolder},target=/home/blue/ws_blue/src/blue,type=bind", + "workspaceFolder": "/home/blue/ws_blue/src/blue", +>>>>>>> 11807c8 (Cleaned up Docker pipelines (#121)) "remoteUser": "blue", "runArgs": [ "--network=host", @@ -43,12 +49,6 @@ "editor.tabSize": 2, "xml.format.maxLineWidth": 100, "json.format.enable": true, - "python.linting.enabled": true, - "python.linting.flake8Enabled": true, - "python.linting.pylintEnabled": false, - "python.linting.pydocstyleEnabled": true, - "python.linting.mypyEnabled": true, - "python.formatting.provider": "black", "autoDocstring.startOnNewLine": false, "autoDocstring.docstringFormat": "google-notypes", "isort.args": ["--profile", "black"], @@ -76,7 +76,8 @@ "editor.rulers": [90], "editor.codeActionsOnSave": { "source.organizeImports": true - } + }, + "editor.defaultFormatter": "ms-python.black-formatter" }, "[dockerfile]": { "editor.quickSuggestions": { diff --git a/.devcontainer/nvidia/Dockerfile b/.devcontainer/nvidia/Dockerfile new file mode 100644 index 00000000..b2259379 --- /dev/null +++ b/.devcontainer/nvidia/Dockerfile @@ -0,0 +1,26 @@ +FROM ghcr.io/robotic-decision-making-lab/blue:rolling-desktop-nvidia + +# Install ROS dependencies +# This is done in a previous stage, but we include it again here in case anyone wants to +# add new dependencies during development +ENV USERNAME=blue +ENV USER_WORKSPACE=/home/$USERNAME/ws_blue +WORKDIR $USER_WORKSPACE + +COPY --chown=$USER_UID:$USER_GID . src/blue +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && rosdep update \ + && rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --skip-keys="gz-transport12 gz-sim7 gz-math7 gz-msgs9 gz-plugin2" \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* + +# Install debugging/linting Python packages +COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . +RUN python3 -m pip install -r requirements-dev.txt \ + && rm -rf requirements-dev.txt + +# Disable the setuputils installation warning +# This prevents us from needing to pin the setuputils version (which doesn't always work) +ENV PYTHONWARNINGS="ignore" diff --git a/.devcontainer/nvidia/devcontainer.json b/.devcontainer/nvidia/devcontainer.json index 8ddb1228..7059dd91 100644 --- a/.devcontainer/nvidia/devcontainer.json +++ b/.devcontainer/nvidia/devcontainer.json @@ -1,6 +1,8 @@ { - "dockerFile": "../../.docker/Dockerfile", + "name": "Blue NVIDIA Dev Container", + "dockerFile": "Dockerfile", "context": "../..", +<<<<<<< HEAD "build": { "args": { "WORKSPACE": "${containerWorkspaceFolder}", @@ -8,6 +10,10 @@ }, "target": "develop-nvidia" }, +======= + "workspaceMount": "source=${localWorkspaceFolder},target=/home/blue/ws_blue/src/blue,type=bind", + "workspaceFolder": "/home/blue/ws_blue/src/blue", +>>>>>>> 11807c8 (Cleaned up Docker pipelines (#121)) "remoteUser": "blue", "runArgs": [ "--network=host", @@ -47,12 +53,6 @@ "editor.tabSize": 2, "xml.format.maxLineWidth": 100, "json.format.enable": true, - "python.linting.enabled": true, - "python.linting.flake8Enabled": true, - "python.linting.pylintEnabled": false, - "python.linting.pydocstyleEnabled": true, - "python.linting.mypyEnabled": true, - "python.formatting.provider": "black", "autoDocstring.startOnNewLine": false, "autoDocstring.docstringFormat": "google-notypes", "isort.args": ["--profile", "black"], @@ -82,7 +82,8 @@ "editor.rulers": [90], "editor.codeActionsOnSave": { "source.organizeImports": true - } + }, + "editor.defaultFormatter": "ms-python.black-formatter" }, "[dockerfile]": { "editor.quickSuggestions": { diff --git a/.docker/Dockerfile b/.docker/Dockerfile index e5e59147..ce156976 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,24 +1,16 @@ -############################################## -# ci: Install core dependencies needed for CI -############################################## ARG ROS_DISTRO=rolling FROM ros:$ROS_DISTRO-ros-base as ci -LABEL maintainer="Evan Palmer" -LABEL maintainer-email="evanp922@gmail.com" - ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root/ws_blue +WORKDIR /root/ws_blue COPY . src/blue -# Install apt packages +# Install apt packages needed for CI RUN apt-get -q update \ && apt-get -q -y upgrade \ && apt-get -q install --no-install-recommends -y \ git \ - wget \ - curl \ sudo \ clang \ clang-format-14 \ @@ -31,25 +23,6 @@ RUN apt-get -q update \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* -# Install the Python requirements that aren't available as rosdeps -RUN python3 -m pip install -r $(pwd)/src/blue/requirements-build.txt - -# Install gstreamer -RUN apt-get -q update \ - && apt-get -q -y upgrade \ - && apt-get -q install --no-install-recommends -y \ - python3-gi \ - gstreamer1.0-tools \ - gir1.2-gstreamer-1.0 \ - gir1.2-gst-plugins-base-1.0 \ - gstreamer1.0-plugins-good \ - gstreamer1.0-plugins-ugly \ - gstreamer1.0-plugins-bad \ - gstreamer1.0-libav \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - # Install all ROS dependencies RUN apt-get -q update \ && apt-get -q -y upgrade \ @@ -60,6 +33,8 @@ RUN apt-get -q update \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* +FROM ci as robot + # Configure a new non-root user ARG USERNAME=blue ARG USER_UID=1000 @@ -69,51 +44,95 @@ RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME \ + && usermod -a -G dialout $USERNAME \ && echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc -# Switch to the non-root user to install MAVROS dependencies +ENV DEBIAN_FRONTEND=noninteractive + +# Switch to the non-root user for the rest of the installation. +# We do this to avoid any conflicts with user permissions USER $USERNAME ENV USER=$USERNAME +# Install some core apt packages +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && sudo apt-get -q install --no-install-recommends -y \ + lsb-release \ + wget \ + gnupg \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* + # Install MAVROS dependencies WORKDIR /home/$USERNAME RUN wget https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/scripts/install_geographiclib_datasets.sh \ && chmod +x install_geographiclib_datasets.sh \ && sudo ./install_geographiclib_datasets.sh -# Switch back to root user -USER root -ENV USER=root +# Copy the project over to the image +ENV USER_WORKSPACE=/home/$USERNAME/ws_blue +WORKDIR $USER_WORKSPACE +COPY --chown=$USER_UID:$USER_GID . src/blue -################################################################# -# sim: install Gazebo and the tools needed for Gazebo simulation -################################################################# -FROM ci as sim +# Install the Python requirements that aren't available as rosdeps +RUN python3 -m pip install -r $(pwd)/src/blue/requirements-build.txt + +# Install gstreamer +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && sudo apt-get -q install --no-install-recommends -y \ + python3-gi \ + gstreamer1.0-tools \ + gir1.2-gstreamer-1.0 \ + gir1.2-gst-plugins-base-1.0 \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-libav \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* + +# Install all ROS dependencies +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && rosdep update \ + && rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* + +# Setup the environment variables +RUN echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \ + && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashr + +FROM robot as desktop + +ENV DEBIAN_FRONTEND=noninteractive +ENV GZ_VERSION=garden # Install Gazebo Garden: https://gazebosim.org/docs/garden/install_ubuntu -RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg -RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null -RUN apt-get update \ - && apt-get -y --quiet --no-install-recommends install \ +RUN sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \ + && sudo apt-get update \ + && sudo apt-get -y --quiet --no-install-recommends install \ gz-garden \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* # Install ArduPilot and ardupilot_gazebo dependencies -RUN apt-get -q update \ - && apt-get -q -y upgrade \ - && apt-get -q install --no-install-recommends -y \ +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && sudo apt-get -q install --no-install-recommends -y \ python3-wxgtk4.0 \ rapidjson-dev \ xterm \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -# Switch to the non-root user to install ArduSub -USER $USERNAME -ENV USER=$USERNAME + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* # Clone ArduSub # ArduSub is installed for simulation purposes ONLY @@ -144,152 +163,43 @@ RUN [ "/bin/bash" , "-c" , " \ && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo \ && make -j4" ] -# Switch back to the root user -USER root -ENV USER=root - -# Extend the ros_entrypoint to source the simulation environment -COPY .docker/entrypoints/sim.sh / -RUN sed -i '/source "\/opt\/ros\/$ROS_DISTRO\/setup\.bash" --/a source /sim.sh' /ros_entrypoint.sh - -################################################## -# deps: Install all external project dependencies -################################################## -FROM sim as deps - -ENV GZ_VERSION=garden -ENV USER_WORKSPACE=/home/$USERNAME/ws_blue/install -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR $USER_WORKSPACE/.. - -COPY blue.repos src/ - -RUN apt-get -q update \ - && apt-get -q -y upgrade \ - && vcs import src < src/blue.repos \ - && rosdep update \ - && rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false --skip-keys="gz-transport12 gz-sim7 gz-math7 gz-msgs9 gz-plugin2" \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \ - && colcon build \ - # Update /ros_entrypoint.sh to source the workspace - && sed -i "s#/opt/ros/\$ROS_DISTRO/setup.bash#$USER_WORKSPACE/setup.sh#g" /ros_entrypoint.sh \ - && echo "source ${USER_WORKSPACE}/setup.sh" >> /home/$USERNAME/.bashrc - -#################################################### -# develop: Setup the image for development purposes -#################################################### -FROM deps as develop - -ENV GZ_VERSION=garden -ENV ROS_UNDERLAY /root/ws_blue/install -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR $ROS_UNDERLAY/.. - -COPY . src/blue - -# Install debugging/linting Python packages -RUN python3 -m pip install -r $(pwd)/src/blue/requirements-dev.txt - -RUN apt-get -q update \ - && apt-get -q -y upgrade \ +# Install Gazebo +WORKDIR $USER_WORKSPACE +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ && vcs import src < src/blue/blue.repos \ && rosdep update \ - && rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false --skip-keys="gz-transport12 gz-sim7 gz-math7 gz-msgs9" \ - && rm -rf src \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -# Install development tools -RUN apt-get -q update \ - && apt-get -q -y upgrade \ - && apt-get -q install --no-install-recommends -y \ - iputils-ping \ - net-tools \ - gdb \ - nano \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -COPY .docker/entrypoints/dev.sh / - -# WARNING: This is a temporary solution for disabling the setuputils installation warning -ENV PYTHONWARNINGS="ignore" - -ARG WORKSPACE -RUN echo "if [ -f ${WORKSPACE}/install/setup.bash ]; then source ${WORKSPACE}/install/setup.bash; fi" >> /home/$USERNAME/.bashrc \ - && echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc \ - # Expose the environment variables to the non-root user - && echo "if [ -f /sim.sh ]; then source /sim.sh; fi" >> /home/$USERNAME/.bashrc \ - && echo "if [ -f /dev.sh ]; then source /dev.sh; fi" >> /home/$USERNAME/.bashrc + && rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --skip-keys="gz-transport12 gz-sim7 gz-math7 gz-msgs9 gz-plugin2" \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* + +# For users that build this on a laptop or system with limited RAM, +# Modify the 'colcon build' line to be 'MAKEFLAGS="-j1 -l1" colcon build' +# This will limit the amount of RAM that colcon is allowed to use +RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \ + && colcon build +# Setup the simulation environment variables +RUN echo "source ${USER_WORKSPACE}/src/blue/.docker/entrypoints/sim.sh" >> /home/$USERNAME/.bashrc -###################################################################################### -# develop-nvidia: Setup the image for development purposes with NVIDIA driver support -###################################################################################### -FROM deps as develop-nvidia +FROM desktop as desktop-nvidia # Install NVIDIA software -RUN apt-get update \ - && apt-get install -y -qq --no-install-recommends \ +RUN sudo apt-get update \ + && sudo apt-get -q -y upgrade \ + && sudo apt-get install -y -qq --no-install-recommends \ libglvnd0 \ libgl1 \ libglx0 \ libegl1 \ libxext6 \ - libx11-6 + libx11-6 \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* # Env vars for the nvidia-container-runtime. ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute ENV QT_X11_NO_MITSHM 1 - -ENV GZ_VERSION=garden -ENV ROS_UNDERLAY /root/ws_blue/install -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR $ROS_UNDERLAY/.. - -COPY . src/blue - -# Install debugging/linting Python packages -RUN python3 -m pip install -r $(pwd)/src/blue/requirements-dev.txt - -RUN apt-get -q update \ - && apt-get -q -y upgrade \ - && vcs import src < src/blue/blue.repos \ - && rosdep update \ - && rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false --skip-keys="gz-transport12 gz-sim7 gz-math7 gz-msgs9 gz-plugin2" \ - && rm -rf src \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -# Install development tools -RUN apt-get -q update \ - && apt-get -q -y upgrade \ - && apt-get -q install --no-install-recommends -y \ - iputils-ping \ - net-tools \ - gdb \ - nano \ - htop \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -COPY .docker/entrypoints/dev.sh / - -# WARNING: This is a temporary solution for disabling the setuputils installation warning -ENV PYTHONWARNINGS="ignore" - -ARG WORKSPACE -RUN echo "if [ -f ${WORKSPACE}/install/setup.bash ]; then source ${WORKSPACE}/install/setup.bash; fi" >> /home/$USERNAME/.bashrc \ - && echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc \ - # Expose the environment variables to the non-root user - && echo "if [ -f /sim.sh ]; then source /sim.sh; fi" >> /home/$USERNAME/.bashrc \ - && echo "if [ -f /dev.sh ]; then source /dev.sh; fi" >> /home/$USERNAME/.bashrc diff --git a/.docker/compose/nouveau-desktop.yaml b/.docker/compose/nouveau-desktop.yaml new file mode 100644 index 00000000..f18588de --- /dev/null +++ b/.docker/compose/nouveau-desktop.yaml @@ -0,0 +1,20 @@ +version: "3" +services: + blue: + image: ghcr.io/robotic-decision-making-lab/blue:rolling-desktop + environment: + - DISPLAY=${DISPLAY} + - XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} + - WAYLAND_DISPLAY=${WAYLAND_DISPLAY} # Can be commented out if not used + - PULSE_SERVER=${PULSE_SERVER} # Can be commented out if not used + network_mode: host + privileged: true + cap_add: + - SYS_PTRACE + security_opt: + - seccomp:unconfined + - apparmor:unconfined + volumes: + - /dev:/dev + - /run/user/1000:/run/user/1000 + command: tail -f /dev/null diff --git a/.docker/compose/nvidia-desktop.yaml b/.docker/compose/nvidia-desktop.yaml new file mode 100644 index 00000000..da240d51 --- /dev/null +++ b/.docker/compose/nvidia-desktop.yaml @@ -0,0 +1,30 @@ +version: "3" +services: + blue: + image: ghcr.io/robotic-decision-making-lab/blue:rolling-desktop-nvidia + environment: + - DISPLAY=${DISPLAY} + - XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} + - LIBGL_ALWAYS_SOFTWARE=1 + - QT_X11_NO_MITSHM=1 + - WAYLAND_DISPLAY=${WAYLAND_DISPLAY} # Can be commented out if not used + - PULSE_SERVER=${PULSE_SERVER} # Can be commented out if not used + network_mode: host + privileged: true + cap_add: + - SYS_PTRACE + security_opt: + - seccomp:unconfined + - apparmor:unconfined + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + volumes: + - /dev:/dev + - /tmp/.X11-unix:/tmp/.X11-unix + - /mnt/wslg:/mnt/wslg + command: tail -f /dev/null diff --git a/.docker/entrypoints/dev.sh b/.docker/entrypoints/dev.sh deleted file mode 100644 index 45d71167..00000000 --- a/.docker/entrypoints/dev.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -# Add blue models and worlds -export GZ_SIM_RESOURCE_PATH=/workspaces/blue/blue_description/gazebo/models:/workspaces/blue/blue_description/gazebo/worlds:$GZ_SIM_RESOURCE_PATH - -# Add blue meshes -export GZ_SIM_RESOURCE_PATH=/workspaces/blue/blue_description/meshes:$GZ_SIM_RESOURCE_PATH diff --git a/.docker/entrypoints/sim.sh b/.docker/entrypoints/sim.sh index c2fe9b80..85b3946b 100644 --- a/.docker/entrypoints/sim.sh +++ b/.docker/entrypoints/sim.sh @@ -9,8 +9,14 @@ export PATH=$HOME/ardupilot/Tools/autotest:$PATH # Add ardupilot_gazebo plugin export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH -# Optional: add ardupilot_gazebo models and worlds +# Add ardupilot_gazebo models and worlds export GZ_SIM_RESOURCE_PATH=$HOME/ardupilot_gazebo/models:$HOME/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH -# Build ros_gz on the humble branch for Gazebo Garden +# Add blue models and worlds +export GZ_SIM_RESOURCE_PATH=$HOME/ws_blue/src/blue/blue_description/gazebo/models:$HOME/ws_blue/src/blue/blue_description/gazebo/worlds:$GZ_SIM_RESOURCE_PATH + +# Add blue meshes +export GZ_SIM_RESOURCE_PATH=$HOME/ws_blue/src/blue/blue_description/meshes:$GZ_SIM_RESOURCE_PATH + +# Build ros_gz for Gazebo Garden export GZ_VERSION=garden diff --git a/.dockerignore b/.dockerignore index c59c0f0b..97eedc18 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,6 +9,7 @@ !blue_localization !blue_utils !blue_joy +!blue_description !blue.repos !.docker/entrypoints !requirements-build.txt diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml index c8af6530..2911cc8a 100644 --- a/.github/ISSUE_TEMPLATE/config.yaml +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -1,5 +1,10 @@ blank_issues_enabled: false contact_links: +<<<<<<< HEAD:.github/ISSUE_TEMPLATE/config.yaml - name: BlueROV2 Driver Community Support url: https://github.com/evan-palmer/blue/discussions +======= + - name: Blue Community Support + url: https://github.com/Robotic-Decision-Making-Lab/blue/discussions +>>>>>>> 11807c8 (Cleaned up Docker pipelines (#121)):.github/ISSUE_TEMPLATE/config.yml about: Please check out our discussions channel for any questions related to the project! diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 189d1228..8e359537 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Continuous Integration +name: CI on: push: @@ -21,10 +21,6 @@ jobs: env: - IMAGE: rolling-ci ROS_DISTRO: rolling - - IMAGE: iron-ci - ROS_DISTRO: iron - - IMAGE: humble-ci - ROS_DISTRO: humble steps: - name: Checkout repository uses: actions/checkout@v3 @@ -41,7 +37,11 @@ jobs: - name: Run ROS Industrial CI uses: ros-industrial/industrial_ci@master env: +<<<<<<< HEAD DOCKER_IMAGE: ghcr.io/evan-palmer/blue:${{ matrix.env.IMAGE }} +======= + DOCKER_IMAGE: ghcr.io/robotic-decision-making-lab/blue:${{ matrix.env.IMAGE }} +>>>>>>> 11807c8 (Cleaned up Docker pipelines (#121)) CXXFLAGS: >- -Wall -Wextra -Wpedantic -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls CC: ${{ env.CLANG_TIDY && 'clang' }} diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 1ebb4acc..92a26910 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -10,6 +10,8 @@ on: paths: - .docker/** - .github/workflows/docker.yaml + - blue.repos + - requirements-build.txt workflow_dispatch: env: @@ -20,7 +22,134 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [humble, iron, rolling] + ROS_DISTRO: [rolling] + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log into registry + if: env.PUSH == 'true' + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + if: env.PUSH == 'true' + id: meta + uses: docker/metadata-action@v4.6.0 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5.0.0 + with: + context: . + file: .docker/Dockerfile + build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + target: ${{ github.job }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: ${{ env.PUSH }} + robot: + strategy: + fail-fast: false + matrix: + ROS_DISTRO: [rolling] + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v3.5.3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.2.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log into registry + if: env.PUSH == 'true' + uses: docker/login-action@v2.2.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + if: env.PUSH == 'true' + id: meta + uses: docker/metadata-action@v4.6.0 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4.1.1 + with: + context: . + file: .docker/Dockerfile + build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + target: ${{ github.job }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: ${{ env.PUSH }} + platforms: linux/amd64,linux/arm64 + desktop: + strategy: + fail-fast: false + matrix: + ROS_DISTRO: [rolling] + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log into registry + if: env.PUSH == 'true' + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + if: env.PUSH == 'true' + id: meta + uses: docker/metadata-action@v4.6.0 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5.0.0 + with: + context: . + file: .docker/Dockerfile + build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + target: ${{ github.job }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: ${{ env.PUSH }} + desktop-nvidia: + strategy: + fail-fast: false + matrix: + ROS_DISTRO: [rolling] runs-on: ubuntu-latest permissions: packages: write From 836133b8a8485365d0671c1de4385223bf2e8b38 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Thu, 12 Oct 2023 16:08:59 -0700 Subject: [PATCH 2/3] Fixed humble backport --- .devcontainer/nouveau/Dockerfile | 2 +- .devcontainer/nouveau/devcontainer.json | 10 ---------- .devcontainer/nvidia/Dockerfile | 2 +- .devcontainer/nvidia/devcontainer.json | 18 ++++-------------- .docker/Dockerfile | 2 +- .docker/compose/nouveau-desktop.yaml | 2 +- .docker/compose/nvidia-desktop.yaml | 2 +- .github/workflows/ci.yaml | 10 +++------- .github/workflows/docker.yaml | 10 +++++----- .github/workflows/format.yaml | 2 +- 10 files changed, 18 insertions(+), 42 deletions(-) diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile index d04fce29..06cd340a 100644 --- a/.devcontainer/nouveau/Dockerfile +++ b/.devcontainer/nouveau/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/robotic-decision-making-lab/blue:rolling-desktop +FROM ghcr.io/robotic-decision-making-lab/blue:humble-desktop # Install ROS dependencies # This is done in a previous stage, but we include it again here in case anyone wants to diff --git a/.devcontainer/nouveau/devcontainer.json b/.devcontainer/nouveau/devcontainer.json index ab37a7a3..eb5b0395 100644 --- a/.devcontainer/nouveau/devcontainer.json +++ b/.devcontainer/nouveau/devcontainer.json @@ -2,18 +2,8 @@ "name": "Blue Nouveau Dev Container", "dockerFile": "Dockerfile", "context": "../..", -<<<<<<< HEAD - "build": { - "args": { - "WORKSPACE": "${containerWorkspaceFolder}", - "ROS_DISTRO": "humble" - }, - "target": "develop" - }, -======= "workspaceMount": "source=${localWorkspaceFolder},target=/home/blue/ws_blue/src/blue,type=bind", "workspaceFolder": "/home/blue/ws_blue/src/blue", ->>>>>>> 11807c8 (Cleaned up Docker pipelines (#121)) "remoteUser": "blue", "runArgs": [ "--network=host", diff --git a/.devcontainer/nvidia/Dockerfile b/.devcontainer/nvidia/Dockerfile index b2259379..3e89d77c 100644 --- a/.devcontainer/nvidia/Dockerfile +++ b/.devcontainer/nvidia/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/robotic-decision-making-lab/blue:rolling-desktop-nvidia +FROM ghcr.io/robotic-decision-making-lab/blue:humble-desktop-nvidia # Install ROS dependencies # This is done in a previous stage, but we include it again here in case anyone wants to diff --git a/.devcontainer/nvidia/devcontainer.json b/.devcontainer/nvidia/devcontainer.json index 7059dd91..827bd171 100644 --- a/.devcontainer/nvidia/devcontainer.json +++ b/.devcontainer/nvidia/devcontainer.json @@ -2,18 +2,8 @@ "name": "Blue NVIDIA Dev Container", "dockerFile": "Dockerfile", "context": "../..", -<<<<<<< HEAD - "build": { - "args": { - "WORKSPACE": "${containerWorkspaceFolder}", - "ROS_DISTRO": "humble" - }, - "target": "develop-nvidia" - }, -======= "workspaceMount": "source=${localWorkspaceFolder},target=/home/blue/ws_blue/src/blue,type=bind", "workspaceFolder": "/home/blue/ws_blue/src/blue", ->>>>>>> 11807c8 (Cleaned up Docker pipelines (#121)) "remoteUser": "blue", "runArgs": [ "--network=host", @@ -58,13 +48,13 @@ "isort.args": ["--profile", "black"], "isort.check": true, "python.autoComplete.extraPaths": [ - "/opt/ros/rolling/lib/python3.10/site-packages/", - "/opt/ros/rolling/local/lib/python3.10/dist-packages/", + "/opt/ros/humble/lib/python3.10/site-packages/", + "/opt/ros/humble/local/lib/python3.10/dist-packages/", "${workspaceFolder}/install/" ], "python.analysis.extraPaths": [ - "/opt/ros/rolling/lib/python3.10/site-packages/", - "/opt/ros/rolling/local/lib/python3.10/dist-packages/", + "/opt/ros/humble/lib/python3.10/site-packages/", + "/opt/ros/humble/local/lib/python3.10/dist-packages/", "${workspaceFolder}/install/" ], "C_Cpp.default.intelliSenseMode": "linux-gcc-x86", diff --git a/.docker/Dockerfile b/.docker/Dockerfile index ce156976..87605a74 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,4 @@ -ARG ROS_DISTRO=rolling +ARG ROS_DISTRO=humble FROM ros:$ROS_DISTRO-ros-base as ci ENV DEBIAN_FRONTEND=noninteractive diff --git a/.docker/compose/nouveau-desktop.yaml b/.docker/compose/nouveau-desktop.yaml index f18588de..8e5babdd 100644 --- a/.docker/compose/nouveau-desktop.yaml +++ b/.docker/compose/nouveau-desktop.yaml @@ -1,7 +1,7 @@ version: "3" services: blue: - image: ghcr.io/robotic-decision-making-lab/blue:rolling-desktop + image: ghcr.io/robotic-decision-making-lab/blue:humble-desktop environment: - DISPLAY=${DISPLAY} - XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} diff --git a/.docker/compose/nvidia-desktop.yaml b/.docker/compose/nvidia-desktop.yaml index da240d51..7e2db6b0 100644 --- a/.docker/compose/nvidia-desktop.yaml +++ b/.docker/compose/nvidia-desktop.yaml @@ -1,7 +1,7 @@ version: "3" services: blue: - image: ghcr.io/robotic-decision-making-lab/blue:rolling-desktop-nvidia + image: ghcr.io/robotic-decision-making-lab/blue:humble-desktop-nvidia environment: - DISPLAY=${DISPLAY} - XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8e359537..5b432ff0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - main + - humble pull_request: workflow_dispatch: @@ -19,8 +19,8 @@ jobs: fail-fast: false matrix: env: - - IMAGE: rolling-ci - ROS_DISTRO: rolling + - IMAGE: humble-ci + ROS_DISTRO: humble steps: - name: Checkout repository uses: actions/checkout@v3 @@ -37,11 +37,7 @@ jobs: - name: Run ROS Industrial CI uses: ros-industrial/industrial_ci@master env: -<<<<<<< HEAD - DOCKER_IMAGE: ghcr.io/evan-palmer/blue:${{ matrix.env.IMAGE }} -======= DOCKER_IMAGE: ghcr.io/robotic-decision-making-lab/blue:${{ matrix.env.IMAGE }} ->>>>>>> 11807c8 (Cleaned up Docker pipelines (#121)) CXXFLAGS: >- -Wall -Wextra -Wpedantic -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls CC: ${{ env.CLANG_TIDY && 'clang' }} diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 92a26910..318e70c2 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -5,7 +5,7 @@ on: - cron: "0 17 * * 6" push: branches: - - main + - humble pull_request: paths: - .docker/** @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [rolling] + ROS_DISTRO: [humble] runs-on: ubuntu-latest permissions: packages: write @@ -62,7 +62,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [rolling] + ROS_DISTRO: [humble] runs-on: ubuntu-latest permissions: packages: write @@ -109,7 +109,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [rolling] + ROS_DISTRO: [humble] runs-on: ubuntu-latest permissions: packages: write @@ -149,7 +149,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [rolling] + ROS_DISTRO: [humble] runs-on: ubuntu-latest permissions: packages: write diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 746d77ba..6c87f5df 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - main + - humble workflow_dispatch: jobs: From 0e8ea82ecfc3248b77d88a925bef9cea78559967 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Thu, 12 Oct 2023 16:12:18 -0700 Subject: [PATCH 3/3] Fixed config merge conflict --- .github/ISSUE_TEMPLATE/config.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml index 2911cc8a..3f1d9873 100644 --- a/.github/ISSUE_TEMPLATE/config.yaml +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -1,10 +1,5 @@ blank_issues_enabled: false contact_links: -<<<<<<< HEAD:.github/ISSUE_TEMPLATE/config.yaml - - name: BlueROV2 Driver Community Support - url: https://github.com/evan-palmer/blue/discussions -======= - name: Blue Community Support url: https://github.com/Robotic-Decision-Making-Lab/blue/discussions ->>>>>>> 11807c8 (Cleaned up Docker pipelines (#121)):.github/ISSUE_TEMPLATE/config.yml about: Please check out our discussions channel for any questions related to the project!