Skip to content

Commit

Permalink
Merge pull request #19 from ika-rwth-aachen/feature/rmw-implementation
Browse files Browse the repository at this point in the history
Choose desired ROS 2 middleware
  • Loading branch information
jpbusch authored Jan 18, 2024
2 parents 7f945ae + 485c5d6 commit 5cbaf02
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci/docker-ros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ variables:
ENABLE_INDUSTRIAL_CI: 'false' # Enable industrial_ci
ENABLE_SINGLEARCH_PUSH: 'false' # Enable push of single arch images with [-amd64|-arm64] postfix
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`)
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
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ Create a folder `additional-files` in your `docker` folder (or configure a diffe
- **`registry-user` | `REGISTRY_USER`**
Docker registry username
*default:* `${{ github.actor }}` | `$CI_REGISTRY_USER`
- **`rmw-implementation` | `RMW_IMPLEMENTATION`**
ROS 2 middleware implementation
*default:* `rmw_cyclonedds_cpp`
*supported values:* `rmw_fastrtps_cpp`, `rmw_cyclonedds_cpp`, `rmw_gurumdds_cpp`, ...
- **`ros-distro` | `ROS_DISTRO`**
ROS Distro
*required if ROS is not installed in `base-image`*
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ inputs:
description: "Docker registry password"
default: ${{ github.token }}

rmw-implementation:
description: "RMW implementation to use (only for ROS 2)"
default: rmw_cyclonedds_cpp

ros-distro:
description: "ROS Distro (required if ROS is not installed in `base-image`)"

Expand Down Expand Up @@ -178,6 +182,7 @@ runs:
IMAGE_TAG: ${{ inputs.image-tag }}
DEV_IMAGE_NAME: ${{ inputs.dev-image-name }}
DEV_IMAGE_TAG: ${{ inputs.dev-image-tag }}
RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }}
ROS_DISTRO: ${{ inputs.ros-distro }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
Expand Down Expand Up @@ -235,6 +240,7 @@ runs:
DEV_IMAGE_NAME: ${{ inputs.dev-image-name }}
DEV_IMAGE_TAG: ${{ inputs.dev-image-tag }}
ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }}
RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }}
ROS_DISTRO: ${{ inputs.ros-distro }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
Expand Down Expand Up @@ -270,6 +276,7 @@ runs:
DEV_IMAGE_NAME: ${{ inputs.dev-image-name }}
DEV_IMAGE_TAG: latest-dev
ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }}
RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }}
ROS_DISTRO: ${{ inputs.ros-distro }}
GIT_HTTPS_SERVER: ${{ inputs.git-https-server }}
GIT_HTTPS_USER: ${{ inputs.git-https-user }}
Expand Down
10 changes: 10 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \
fi \
&& rm -rf /var/lib/apt/lists/*

# install desired ROS 2 middleware
ARG RMW_IMPLEMENTATION
ENV RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION}
RUN if [[ "$ROS_VERSION" == "2" ]]; then \
apt-get update && \
RMW_PACKAGE=ros-$ROS_DISTRO-$(echo $RMW_IMPLEMENTATION | tr '_' '-') && \
apt-get install -y $RMW_PACKAGE && \
rm -rf /var/lib/apt/lists/* ; \
fi

# source ROS
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc

Expand Down
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ build_image() {
$(if [[ "${_ENABLE_IMAGE_PUSH}" == "true" ]]; then echo "--push"; else echo "--load"; fi) \
--build-arg BASE_IMAGE="${BASE_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 "${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) \
Expand Down
1 change: 1 addition & 0 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DEV_IMAGE_TAG="${DEV_IMAGE_TAG:-${IMAGE_TAG}-dev}"
IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
DEV_IMAGE="${DEV_IMAGE_NAME}:${DEV_IMAGE_TAG}"
ENABLE_SINGLEARCH_PUSH="${ENABLE_SINGLEARCH_PUSH:-false}"
RMW_IMPLEMENTATION="${RMW_IMPLEMENTATION:-}"
ROS_DISTRO="${ROS_DISTRO:-}"
GIT_HTTPS_SERVER="${GIT_HTTPS_SERVER:-}"
GIT_HTTPS_USER="${GIT_HTTPS_USER:-}"
Expand Down
1 change: 1 addition & 0 deletions templates/docker-compose.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ x-build: &build
GIT_HTTPS_USER: $GIT_HTTPS_USER
GIT_SSH_KNOWN_HOST_KEYS: $GIT_SSH_KNOWN_HOST_KEYS
GIT_SSH_PRIVATE_KEY: $GIT_SSH_PRIVATE_KEY
RMW_IMPLEMENTATION: $RMW_IMPLEMENTATION
ROS_DISTRO: $ROS_DISTRO

services:
Expand Down

0 comments on commit 5cbaf02

Please sign in to comment.