Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ jobs:
scenario:
- humble
- kilted
- ros_core
- lyrical
- osrf_ros
- upstream_ros
Expand Down
2 changes: 1 addition & 1 deletion features/src/ros2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-<distro>- prefix. | string | - |
| workspace | Workspace whose install/setup.sh file should be sourced when present. | string | ${containerWorkspaceFolder} |

Expand Down
8 changes: 6 additions & 2 deletions features/src/ros2/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 0 additions & 9 deletions features/src/ros2/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions features/test/ros2/ros_core.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions features/test/ros2/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" } }
Expand Down
17 changes: 17 additions & 0 deletions features/test/ros2/validate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")