From 0b386ea15967bab80cdb41c306424c2279f5538d Mon Sep 17 00:00:00 2001 From: Allison Thackston <73732028+althack@users.noreply.github.com> Date: Sun, 16 Aug 2026 21:51:22 -0700 Subject: [PATCH] Support additional ROS 2 package variants --- .github/workflows/test-pr.yaml | 1 + features/src/ros2/README.md | 2 +- features/src/ros2/devcontainer-feature.json | 8 ++++++-- features/src/ros2/install.sh | 9 --------- features/test/ros2/ros_core.sh | 10 ++++++++++ features/test/ros2/scenarios.json | 4 ++++ features/test/ros2/validate_config.py | 17 +++++++++++++++++ 7 files changed, 39 insertions(+), 12 deletions(-) create mode 100755 features/test/ros2/ros_core.sh diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml index 73914ca..57144bc 100644 --- a/.github/workflows/test-pr.yaml +++ b/.github/workflows/test-pr.yaml @@ -119,6 +119,7 @@ jobs: scenario: - humble - kilted + - ros_core - lyrical - osrf_ros - upstream_ros diff --git a/features/src/ros2/README.md b/features/src/ros2/README.md index 9af16eb..583ed6e 100644 --- a/features/src/ros2/README.md +++ b/features/src/ros2/README.md @@ -16,7 +16,7 @@ Install ROS 2 and the tools needed to develop ROS packages. | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| | distro | ROS 2 distribution to install. By default, select the recommended distribution for the container's Ubuntu release. | string | auto | -| package | ROS 2 metapackage to install. | string | desktop | +| package | ROS 2 metapackage to install. Common variants are suggested. | string | desktop | | additionalPackages | Space-separated ROS package suffixes to install in addition to the selected metapackage, without the ros-- prefix. | string | - | | workspace | Workspace whose install/setup.sh file should be sourced when present. | string | ${containerWorkspaceFolder} | diff --git a/features/src/ros2/devcontainer-feature.json b/features/src/ros2/devcontainer-feature.json index 080138f..33fff96 100644 --- a/features/src/ros2/devcontainer-feature.json +++ b/features/src/ros2/devcontainer-feature.json @@ -21,11 +21,15 @@ "package": { "type": "string", "proposals": [ + "ros-core", "ros-base", - "desktop" + "desktop", + "perception", + "simulation", + "desktop-full" ], "default": "desktop", - "description": "ROS 2 metapackage to install." + "description": "ROS 2 metapackage to install. Common variants are suggested." }, "additionalPackages": { "type": "string", diff --git a/features/src/ros2/install.sh b/features/src/ros2/install.sh index 414d3c7..034ef91 100755 --- a/features/src/ros2/install.sh +++ b/features/src/ros2/install.sh @@ -27,15 +27,6 @@ if [[ "${ID:-}" != "ubuntu" ]]; then exit 1 fi -case "${ros_package}" in - ros-base | desktop) - ;; - *) - echo "Unsupported ROS 2 package: ${ros_package}." >&2 - exit 1 - ;; -esac - export DEBIAN_FRONTEND=noninteractive apt-get update diff --git a/features/test/ros2/ros_core.sh b/features/test/ros2/ros_core.sh new file mode 100755 index 0000000..d058484 --- /dev/null +++ b/features/test/ros2/ros_core.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e +source dev-container-features-test-lib + +check "ROS 2 Kilted is selected" bash -lc '[ "${ROS_DISTRO:-}" = "kilted" ]' +check "ros-core metapackage is installed" bash -lc 'test "$(dpkg-query -W -f="\${db:Status-Status}" "ros-${ROS_DISTRO}-ros-core")" = installed' +check "ROS 2 tooling is installed" bash -lc 'ros2 pkg prefix rclcpp >/dev/null' + +reportResults diff --git a/features/test/ros2/scenarios.json b/features/test/ros2/scenarios.json index 4b4bdc8..bf637be 100644 --- a/features/test/ros2/scenarios.json +++ b/features/test/ros2/scenarios.json @@ -17,6 +17,10 @@ } } }, + "ros_core": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04", + "features": { "ros2": { "distro": "kilted", "package": "ros-core" } } + }, "lyrical": { "image": "ubuntu:26.04", "features": { "ros2": { "package": "ros-base" } } diff --git a/features/test/ros2/validate_config.py b/features/test/ros2/validate_config.py index 345aa34..e8a1c1c 100644 --- a/features/test/ros2/validate_config.py +++ b/features/test/ros2/validate_config.py @@ -16,6 +16,15 @@ ubuntu_releases = config["ubuntuReleases"] proposals = manifest["options"]["distro"]["proposals"] default = manifest["options"]["distro"]["default"] +package_proposals = manifest["options"]["package"]["proposals"] +expected_package_proposals = { + "ros-core", + "ros-base", + "desktop", + "perception", + "simulation", + "desktop-full", +} if set(config) != {"ubuntuReleases"}: raise SystemExit("distributions.json must contain only ubuntuReleases") @@ -51,4 +60,12 @@ if default != "auto": raise SystemExit("The default ROS 2 distro option must be auto") +if set(package_proposals) != expected_package_proposals: + raise SystemExit( + "ROS 2 package proposals must contain exactly the standard variants" + ) + +if len(package_proposals) != len(expected_package_proposals): + raise SystemExit("ROS 2 package proposals must not contain duplicates") + print(f"Validated {len(distributions)} ROS 2 distribution definitions")