Skip to content

Commit f013b8e

Browse files
authored
Fix mixing ament_cmake_auto rosdep, update CI to use base images rather than ros-core images
1 parent bc84622 commit f013b8e

File tree

4 files changed

+85
-29
lines changed

4 files changed

+85
-29
lines changed

.github/workflows/debian-packages.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ jobs:
5959
runs-on: ubuntu-latest
6060
needs: [determine-distros]
6161
container:
62-
image: ros:${{ matrix.ros_distro }}-ros-base-${{ matrix.ubuntu_distro }}
63-
credentials:
64-
username: ${{ secrets.DOCKERHUB_USERNAME }}
65-
password: ${{ secrets.DOCKERHUB_TOKEN }}
62+
image: ubuntu:${{ matrix.ubuntu_distro }}
6663

6764
strategy:
6865
fail-fast: false
@@ -89,6 +86,8 @@ jobs:
8986
chmod +x scripts/build_debian_packages.sh
9087
./scripts/build_debian_packages.sh ${{ matrix.ros_distro }} ${{ matrix.ubuntu_distro }}
9188
shell: bash
89+
env:
90+
DEBIAN_FRONTEND: noninteractive
9291

9392
- name: Upload Debian packages
9493
uses: actions/upload-artifact@v4
@@ -102,10 +101,7 @@ jobs:
102101
runs-on: ubuntu-latest
103102
needs: [determine-distros, generate-debian]
104103
container:
105-
image: ros:${{ matrix.ros_distro }}-ros-base-${{ matrix.ubuntu_distro }}
106-
credentials:
107-
username: ${{ secrets.DOCKERHUB_USERNAME }}
108-
password: ${{ secrets.DOCKERHUB_TOKEN }}
104+
image: ubuntu:${{ matrix.ubuntu_distro }}
109105

110106
strategy:
111107
fail-fast: false
@@ -124,10 +120,24 @@ jobs:
124120
ubuntu_distro: noble
125121

126122
steps:
127-
- name: Setup environment
123+
- name: Setup ROS repository and install base ROS
128124
run: |
125+
export DEBIAN_FRONTEND=noninteractive
126+
export TZ=Etc/UTC
127+
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
128+
129+
apt-get update -qq
130+
apt-get install -y curl gnupg lsb-release
131+
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
132+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2.list
129133
apt-get update -qq
130134
135+
# Install minimal ROS to get /opt/ros and basic infrastructure
136+
apt-get install -y ros-${{ matrix.ros_distro }}-ros-core
137+
shell: bash
138+
env:
139+
DEBIAN_FRONTEND: noninteractive
140+
131141
- name: Download Debian packages
132142
uses: actions/download-artifact@v4
133143
with:
@@ -140,12 +150,14 @@ jobs:
140150
echo "Smoke testing install on ROS2 ${{ matrix.ros_distro }}"
141151
ls -la debian_packages/${{ matrix.ros_distro }}/
142152
143-
# Install the debian packages
153+
# Install the debian packages on top of ros-core
144154
apt-get install -y ./debian_packages/${{ matrix.ros_distro }}/ros-${{ matrix.ros_distro }}-greenwave-monitor-interfaces_*.deb ./debian_packages/${{ matrix.ros_distro }}/ros-${{ matrix.ros_distro }}-greenwave-monitor_*.deb ./debian_packages/${{ matrix.ros_distro }}/ros-${{ matrix.ros_distro }}-r2s-gw_*.deb
145155
146156
# Verify packages are installed
147157
dpkg -s ros-${{ matrix.ros_distro }}-r2s-gw ros-${{ matrix.ros_distro }}-greenwave-monitor ros-${{ matrix.ros_distro }}-greenwave-monitor-interfaces
148158
shell: bash
159+
env:
160+
DEBIAN_FRONTEND: noninteractive
149161

150162
- name: Test ncurses_dashboard execution (no extra dependencies)
151163
run: |

.github/workflows/ros-tests.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ jobs:
3030
name: Test ROS2 ${{ matrix.ros_distro }}
3131
runs-on: ubuntu-latest
3232
container:
33-
image: ros:${{ matrix.ros_distro }}-ros-base-${{ matrix.ubuntu_distro }}
34-
credentials:
35-
username: ${{ secrets.DOCKERHUB_USERNAME }}
36-
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
image: ubuntu:${{ matrix.ubuntu_distro }}
3734

3835
strategy:
3936
fail-fast: false
@@ -54,11 +51,28 @@ jobs:
5451
- name: Checkout code
5552
uses: actions/checkout@v4
5653

57-
- name: Setup ROS environment
54+
- name: Setup ROS repository and install rosdep
5855
run: |
59-
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
60-
apt-get update -qq && apt-get install -y build-essential python3-pip
56+
export DEBIAN_FRONTEND=noninteractive
57+
export TZ=Etc/UTC
58+
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
59+
60+
apt-get update -qq
61+
apt-get install -y curl gnupg lsb-release
62+
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
63+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2.list
64+
apt-get update -qq
65+
apt-get install -y python3-rosdep python3-colcon-common-extensions build-essential cmake git python3-pip
66+
shell: bash
67+
68+
- name: Initialize rosdep and install dependencies
69+
run: |
70+
rosdep init
71+
rosdep update --include-eol-distros
72+
rosdep install --from-paths . --rosdistro ${{ matrix.ros_distro }} --ignore-src -r -y
6173
shell: bash
74+
env:
75+
DEBIAN_FRONTEND: noninteractive
6276

6377
- name: Install Python dependencies
6478
run: |

greenwave_monitor/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<author>Sean Gillen/[email protected], Ann Li/[email protected]></author>
2929

3030
<buildtool_depend>ament_cmake</buildtool_depend>
31+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
3132
<buildtool_depend>ament_cmake_python</buildtool_depend>
3233

3334
<depend>rclcpp</depend>

scripts/build_debian_packages.sh

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#
3030
# Docker Usage (Recommended):
3131
# docker run -it --rm -v $(pwd):/workspace -w /workspace \
32-
# ros:humble-ros-base-jammy ./scripts/build_debian_packages.sh humble jammy
32+
# ubuntu:jammy ./scripts/build_debian_packages.sh humble jammy
3333
#
3434
# Supported combinations:
3535
# humble/jammy, iron/jammy, jazzy/noble, kilted/noble, rolling/noble
@@ -71,22 +71,37 @@ esac
7171

7272
echo "Building Debian packages for ROS $ROS_DISTRO on Ubuntu $UBUNTU_DISTRO"
7373

74-
# Check if running in ROS container or local system
75-
if [ ! -f "/opt/ros/$ROS_DISTRO/setup.bash" ]; then
76-
echo "Error: ROS $ROS_DISTRO not found at /opt/ros/$ROS_DISTRO/setup.bash"
77-
echo "Please run this script in a ROS $ROS_DISTRO container or install ROS $ROS_DISTRO locally"
74+
# Check if running in a container (recommended) or warn user
75+
if [ ! -f "/.dockerenv" ] && [ ! -f "/run/.containerenv" ]; then
76+
echo "WARNING: Not running in a container. This script is designed to run in a clean Ubuntu container."
7877
echo ""
79-
echo "To run in Docker:"
80-
echo " docker run -it --rm -v \$(pwd):/workspace -w /workspace ros:$ROS_DISTRO-ros-base-$UBUNTU_DISTRO ./scripts/build_debian_packages.sh $ROS_DISTRO $UBUNTU_DISTRO"
81-
exit 1
78+
echo "Recommended: Run in Docker with:"
79+
echo " docker run -it --rm -v \$(pwd):/workspace -w /workspace ubuntu:$UBUNTU_DISTRO ./scripts/build_debian_packages.sh $ROS_DISTRO $UBUNTU_DISTRO"
80+
echo ""
81+
echo "Press Ctrl+C to cancel, or Enter to continue anyway (not recommended)..."
82+
read -r
8283
fi
8384

84-
# Source ROS environment
85-
source /opt/ros/$ROS_DISTRO/setup.bash
85+
# Setup ROS repository if not already configured
86+
echo "Setting up ROS repository..."
87+
export DEBIAN_FRONTEND=noninteractive
88+
export TZ=Etc/UTC
89+
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
90+
91+
apt-get update -qq
92+
apt-get install -y curl gnupg lsb-release
93+
94+
if [ ! -f "/etc/apt/sources.list.d/ros2.list" ]; then
95+
echo "Adding ROS 2 apt repository..."
96+
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
97+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2.list
98+
apt-get update -qq
99+
else
100+
echo "ROS 2 repository already configured"
101+
fi
86102

87103
# Install dependencies
88104
echo "Installing build dependencies..."
89-
apt-get update -qq
90105

91106
# Check if we need --break-system-packages for pip
92107
USE_BREAK_SYSTEM_PACKAGES=""
@@ -95,7 +110,7 @@ if [[ "$ROS_DISTRO" == "jazzy" || "$ROS_DISTRO" == "kilted" || "$ROS_DISTRO" ==
95110
fi
96111

97112
# Install system dependencies
98-
apt-get install -y build-essential python3-pip python3-bloom python3-rosdep git lsb-release devscripts debhelper fakeroot
113+
apt-get install -y build-essential python3-pip python3-bloom python3-rosdep git devscripts debhelper fakeroot python3-colcon-common-extensions cmake
99114

100115
# Install Python dependencies
101116
if [ -f "requirements.txt" ]; then
@@ -108,6 +123,20 @@ if [ -f "requirements.txt" ]; then
108123
fi
109124
fi
110125

126+
# Initialize rosdep and install all build dependencies
127+
echo "Initializing rosdep and resolving dependencies..."
128+
rosdep init 2>/dev/null || true
129+
rosdep update --include-eol-distros
130+
rosdep install --from-paths . --rosdistro "$ROS_DISTRO" --ignore-src -r -y
131+
132+
# Source ROS environment (now installed via rosdep)
133+
if [ ! -f "/opt/ros/$ROS_DISTRO/setup.bash" ]; then
134+
echo "Error: ROS $ROS_DISTRO not found after rosdep install"
135+
echo "This should have been installed by rosdep. Check package.xml dependencies."
136+
exit 1
137+
fi
138+
source /opt/ros/$ROS_DISTRO/setup.bash
139+
111140
# Build workspace first
112141
echo "Building workspace..."
113142
colcon build --packages-up-to r2s_gw

0 commit comments

Comments
 (0)