Skip to content

Commit

Permalink
Merge pull request #38 from ika-rwth-aachen/option-to-disable-ros-ins…
Browse files Browse the repository at this point in the history
…tall

Add option to disable automatic ROS installation
  • Loading branch information
lreiher authored Nov 7, 2024
2 parents 0d0b5b1 + f288457 commit 3d97668
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci/docker-ros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ variables:
ENABLE_PUSH_AS_LATEST: 'false' # Push images with tag `latest`/`latest-dev` in addition to the configured image names
RMW_IMPLEMENTATION: 'rmw_cyclonedds_cpp' # RMW implementation to use (only for ROS 2)
ROS_DISTRO: '' # ROS Distro (required if ROS is not installed in `base-image`)
DISABLE_ROS_INSTALLATION: 'false' # Disable automatic installation of `ros-$ROS_DISTRO-ros-core` package, e.g., if ROS is already installed in `base-image` and package is not available for the OS
GIT_HTTPS_SERVER: ${CI_SERVER_HOST} # Server URL (without protocol) for cloning private Git repositories via HTTPS
GIT_HTTPS_USER: gitlab-ci-token # Username for cloning private Git repositories via HTTPS
GIT_HTTPS_PASSWORD: ${CI_JOB_TOKEN} # Password for cloning private Git repositories via HTTPS
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ The password of the custom user is set to its username (`dockeruser:dockeruser`
- **`dev-image-tag` | `DEV_IMAGE_TAG`**
Image tag of dev image
*default:* `<IMAGE_TAG>-dev`
- **`disable-ros-installation` | `DISABLE_ROS_INSTALLATION`**
Disable automatic installation of `ros-$ROS_DISTRO-ros-core` package
*e.g., if ROS is already installed in `base-image` and package is not available for the OS*
*default:* `false`
- **`-` | `DOCKER_ROS_GIT_REF`**
Git reference of *docker-ros* to run in CI
*default:* `main`
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ inputs:
ros-distro:
description: "ROS Distro (required if ROS is not installed in `base-image`)"

disable-ros-installation:
description: "Disable automatic installation of `ros-$ROS_DISTRO-ros-core` package, e.g., if ROS is already installed in `base-image` and package is not available for the OS"
default: false

git-https-server:
description: "Server URL (without protocol) for cloning private Git repositories via HTTPS"
default: "github.com"
Expand Down Expand Up @@ -229,6 +233,7 @@ runs:
SLIM_BUILD_ARGS: ${{ inputs.slim-build-args }}
RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }}
ROS_DISTRO: ${{ inputs.ros-distro }}
DISABLE_ROS_INSTALLATION: ${{ inputs.disable-ros-installation }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }}
Expand Down Expand Up @@ -291,6 +296,7 @@ runs:
ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }}
RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }}
ROS_DISTRO: ${{ inputs.ros-distro }}
DISABLE_ROS_INSTALLATION: ${{ inputs.disable-ros-installation }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }}
Expand Down Expand Up @@ -331,6 +337,7 @@ runs:
ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }}
RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }}
ROS_DISTRO: ${{ inputs.ros-distro }}
DISABLE_ROS_INSTALLATION: ${{ inputs.disable-ros-installation }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }}
Expand Down
21 changes: 15 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# install ROS bootstrapping tools
ARG DISABLE_ROS_INSTALLATION="false"
RUN apt-get update && \
apt-get install -y \
git \
python3-rosdep \
python3-vcstool \
ros-${ROS_DISTRO}-ros-core \
&& rm -rf /var/lib/apt/lists/*
python3-vcstool && \
if [[ "$DISABLE_ROS_INSTALLATION" != "true" ]]; then \
apt-get install -y ros-${ROS_DISTRO}-ros-core; \
fi && \
rm -rf /var/lib/apt/lists/*

# copy contents of repository
COPY . src/target
Expand Down Expand Up @@ -178,14 +181,17 @@ ARG ADDITIONAL_FILES_DIR="docker/additional-files"
ADD ${ADDITIONAL_FILES_DIR}* /docker-ros/additional-files/
# install essential build tools and dependencies for install script
ARG DISABLE_ROS_INSTALLATION="false"
RUN apt-get update && \
apt-get install -y \
build-essential \
gosu \
python-is-python3 \
python3-pip \
ros-${ROS_DISTRO}-ros-core \
&& rm -rf /var/lib/apt/lists/*
python3-pip && \
if [[ "$DISABLE_ROS_INSTALLATION" != "true" ]]; then \
apt-get install -y ros-${ROS_DISTRO}-ros-core; \
fi && \
rm -rf /var/lib/apt/lists/*
# configure pip
RUN python -m pip config --global set global.break-system-packages true
Expand Down Expand Up @@ -217,6 +223,9 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \
if [[ "$RMW_IMPLEMENTATION" == "rmw_zenoh_cpp" ]]; then \
mkdir -p /opt/ws_rmw_zenoh/src && \
git clone https://github.com/ros2/rmw_zenoh.git /opt/ws_rmw_zenoh/src/rmw_zenoh && \
if [[ "$UBUNTU_VERSION" == "22.04" ]]; then \
git clone https://github.com/eProsima/Fast-CDR.git /opt/ws_rmw_zenoh/src/Fast-CDR ; \
fi && \
rosdep init || true && \
rosdep update --rosdistro $ROS_DISTRO && \
apt-get update && \
Expand Down
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ build_image() {
--build-arg COMMAND="${COMMAND}" \
$(if [[ -n "${RMW_IMPLEMENTATION}" ]]; then echo "--build-arg RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION}"; fi) \
$(if [[ -n "${ROS_DISTRO}" ]]; then echo "--build-arg ROS_DISTRO=${ROS_DISTRO}"; fi) \
$(if [[ -n "${DISABLE_ROS_INSTALLATION}" ]]; then echo "--build-arg DISABLE_ROS_INSTALLATION=${DISABLE_ROS_INSTALLATION}"; fi) \
$(if [[ -n "${GIT_HTTPS_SERVER}" ]]; then echo "--build-arg GIT_HTTPS_SERVER=${GIT_HTTPS_SERVER}"; fi) \
$(if [[ -n "${GIT_HTTPS_USER}" ]]; then echo "--build-arg GIT_HTTPS_USER=${GIT_HTTPS_USER}"; fi) \
$(if [[ -n "${GIT_HTTPS_PASSWORD}" ]]; then echo "--build-arg GIT_HTTPS_PASSWORD=${GIT_HTTPS_PASSWORD}"; fi) \
Expand Down
1 change: 1 addition & 0 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SLIM_BUILD_ARGS="${SLIM_BUILD_ARGS:-'--sensor-ipc-mode proxy --continue-after=10
ENABLE_SINGLEARCH_PUSH="${ENABLE_SINGLEARCH_PUSH:-false}"
RMW_IMPLEMENTATION="${RMW_IMPLEMENTATION:-}"
ROS_DISTRO="${ROS_DISTRO:-}"
DISABLE_ROS_INSTALLATION="${DISABLE_ROS_INSTALLATION:-}"
GIT_HTTPS_SERVER="${GIT_HTTPS_SERVER:-}"
GIT_HTTPS_USER="${GIT_HTTPS_USER:-}"
GIT_HTTPS_PASSWORD="${GIT_HTTPS_PASSWORD:-}"
Expand Down

0 comments on commit 3d97668

Please sign in to comment.