Skip to content

Commit

Permalink
Backport Jazzy changes to Iron
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-palmer committed Sep 23, 2024
2 parents de1ffb1 + 4e7a2b4 commit ccb6453
Show file tree
Hide file tree
Showing 45 changed files with 913 additions and 1,295 deletions.
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ AlignAfterOpenBracket: AlwaysBreak
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 2
DerivePointerAlignment: false
AllowAllParametersOfDeclarationOnNextLine: false
PointerAlignment: Middle
PackConstructorInitializers: Never
BinPackArguments: false
BinPackParameters: false

# Configure brace wrapping cases
BreakBeforeBraces: Custom
Expand Down
2 changes: 0 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Checks: >
-google-readability-namespace-comments,
-google-runtime-references,
-misc-non-private-member-variables-in-classes,
-modernize-return-braced-init-list,
-modernize-use-trailing-return-type,
-readability-braces-around-statements,
-readability-identifier-length,
-readability-magic-numbers,
Expand Down
70 changes: 31 additions & 39 deletions .docker/Dockerfile → .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG ROS_DISTRO=iron
FROM ros:$ROS_DISTRO-ros-base as ci
FROM ros:$ROS_DISTRO-ros-base

ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /root/ws_ros
Expand All @@ -15,32 +15,17 @@ RUN apt-get -q update \
git \
sudo \
clang \
clang-format-14 \
clang-tidy \
clang-tools \
python3-pip \
python3-dev \
python3-venv \
apt-utils \
software-properties-common \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Install all ROS dependencies needed for CI
RUN vcs import src < src/$PROJECT_NAME/ros2.repos \
&& apt-get -q update \
&& apt-get -q -y upgrade \
&& rosdep update \
&& rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false \
&& rm -rf src \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

FROM ci as desktop

# Configure a new non-root user
ARG USERNAME=ros
# Configure the ubuntu non-root user
ARG USERNAME=ubuntu
ARG USER_UID=1000
ARG USER_GID=$USER_UID

Expand All @@ -51,50 +36,57 @@ RUN groupadd --gid $USER_GID $USERNAME \
&& usermod -a -G dialout $USERNAME \
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc

# Switch to the non-root user
# Switch to the ubuntu user
USER $USERNAME
ENV USER=$USERNAME

ENV DEBIAN_FRONTEND=noninteractive
ENV USER_WORKSPACE=/home/$USERNAME/ws_ros
WORKDIR $USER_WORKSPACE

COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME

# Create a new virtual environment for Python
ENV VIRTUAL_ENV=$USER_WORKSPACE/.venv/$PROJECT_NAME
RUN python3 -m venv --system-site-packages $VIRTUAL_ENV \
&& echo "source ${VIRTUAL_ENV}/bin/activate" >> /home/$USERNAME/.bashrc \
&& touch .venv/COLCON_IGNORE \
&& echo "\n# Ensure colcon is run in the venv\nalias colcon='python3 -m colcon'" >> /home/$USERNAME/.bashrc
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# Install all ROS dependencies
RUN vcs import src < src/$PROJECT_NAME/ros2.repos
WORKDIR $USER_WORKSPACE
RUN vcs import src < src/$PROJECT_NAME/ros2.repos \
&& sudo apt-get -q update \
RUN sudo apt-get -q update \
&& sudo apt-get -q -y upgrade \
&& rosdep update \
&& rosdep install -y --from-paths src --ignore-src -r --rosdistro ${ROS_DISTRO} \
&& 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/*

RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
&& colcon build \
&& sudo sed -i "s#/opt/ros/\$ROS_DISTRO/setup.bash#$USER_WORKSPACE/setup.sh#g" /ros_entrypoint.sh \
&& echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc

FROM desktop as desktop-nvidia
WORKDIR $USER_WORKSPACE

# Install debugging/linting Python packages
RUN pip install \
pre-commit \
mypy

# Install NVIDIA software
RUN sudo apt-get update \
# Install debugging/linting C++ packages
RUN sudo apt-get -q update \
&& sudo apt-get -q -y upgrade \
&& sudo apt-get install -y -qq --no-install-recommends \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6 \
&& sudo apt-get install -y \
clang-format-14 \
clang-tidy \
clang-tools \
&& 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
# Disable the setuputils installation warning
# This prevents us from needing to pin the setuputils version (which doesn't always work)
ENV PYTHONWARNINGS="ignore"
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "ROS 2 Dev Container",
"dockerFile": "Dockerfile",
"context": "../",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/ws_ros/src/auv_controllers,type=bind",
"workspaceFolder": "/home/ubuntu/ws_ros/src/auv_controllers",
"remoteUser": "ubuntu",
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"ms-python.python",
"njpwerner.autodocstring",
"ms-vscode.cpptools",
"redhat.vscode-xml",
"redhat.vscode-yaml",
"smilerobotics.urdf",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"xaver.clang-format",
"charliermarsh.ruff",
"ms-vscode.cmake-tools"
]
}
}
}
27 changes: 0 additions & 27 deletions .devcontainer/nouveau/Dockerfile

This file was deleted.

42 changes: 0 additions & 42 deletions .devcontainer/nouveau/devcontainer.json

This file was deleted.

27 changes: 0 additions & 27 deletions .devcontainer/nvidia/Dockerfile

This file was deleted.

46 changes: 0 additions & 46 deletions .devcontainer/nvidia/devcontainer.json

This file was deleted.

4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# ignore everything

*

# Except the following
!requirements-dev.txt

!auv_controllers
!velocity_controllers
!thruster_allocation_matrix_controller
!thruster_controllers
!auv_control_msgs
!auv_control_demos
!ros2.repos
44 changes: 44 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
pull_request_rules:
- name: backport to iron at reviewers' discretion
conditions:
- base=main
- "label=backport-iron"
actions:
backport:
branches:
- iron

- name: backport to humble at reviewers' discretion
conditions:
- base=main
- "label=backport-humble"
actions:
backport:
branches:
- humble

- name: backport to jazzy at reviewers' discretion
conditions:
- base=main
- "label=backport-jazzy"
actions:
backport:
branches:
- jazzy

- name: ask to resolve conflict
conditions:
- conflict
- author!=mergify[bot]
actions:
comment:
message: This pull request is in conflict. Could you fix it @{{author}}?

- name: development targets main branch
conditions:
- base!=main
- author!=mergify[bot]
actions:
comment:
message: |
Please target the `main` branch for development, we will backport the changes to {{base}} for you if approved and if they don't break API.
Loading

0 comments on commit ccb6453

Please sign in to comment.