From 1c122633c2d9edab43e91be4b9c0e58e452e9d2b Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 19 Nov 2024 21:18:07 +0000 Subject: [PATCH 1/3] add variable to control git ref of rmw_zenoh --- .gitlab-ci/docker-ros.yml | 1 + README.md | 3 +++ action.yml | 7 +++++++ docker/Dockerfile | 9 ++++++++- scripts/build.sh | 1 + scripts/ci.sh | 1 + 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci/docker-ros.yml b/.gitlab-ci/docker-ros.yml index f4c33bd..7dd0052 100644 --- a/.gitlab-ci/docker-ros.yml +++ b/.gitlab-ci/docker-ros.yml @@ -29,6 +29,7 @@ variables: 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) + RMW_ZENOH_GIT_REF: '28d917e0532fed6e9703f044662298f2b3553716' # Git ref of rmw_zenoh repo to build if `RMW_IMPLEMENTATION=rmw_zenoh_cpp` 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 diff --git a/README.md b/README.md index 998d178..2f7623c 100644 --- a/README.md +++ b/README.md @@ -466,6 +466,9 @@ The password of the custom user is set to its username (`dockeruser:dockeruser` ROS 2 middleware implementation *default:* `rmw_cyclonedds_cpp` *supported values:* `rmw_zenoh_cpp`, `rmw_fastrtps_cpp`, `rmw_cyclonedds_cpp`, `rmw_gurumdds_cpp`, ... +- **`rmw-zenoh-git-ref` | `RMW_ZENOH_GIT_REF`** + Git ref of rmw_zenoh repo to build if `RMW_IMPLEMENTATION=rmw_zenoh_cpp` + *default:* `28d917e0532fed6e9703f044662298f2b3553716` - **`ros-distro` | `ROS_DISTRO`** ROS Distro *required if ROS is not installed in `base-image`* diff --git a/action.yml b/action.yml index bb78023..4059735 100644 --- a/action.yml +++ b/action.yml @@ -62,6 +62,10 @@ inputs: description: "RMW implementation to use (only for ROS 2)" default: rmw_cyclonedds_cpp + rmw-implementation: + description: "Git ref of rmw_zenoh repo to build if `RMW_IMPLEMENTATION=rmw_zenoh_cpp`" + default: 28d917e0532fed6e9703f044662298f2b3553716 + ros-distro: description: "ROS Distro (required if ROS is not installed in `base-image`)" @@ -232,6 +236,7 @@ runs: ENABLE_SLIM: ${{ inputs.enable-slim }} SLIM_BUILD_ARGS: ${{ inputs.slim-build-args }} RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} + RMW_ZENOH_GIT_REF: ${{ inputs.rmw-zenoh-git-ref }} ROS_DISTRO: ${{ inputs.ros-distro }} DISABLE_ROS_INSTALLATION: ${{ inputs.disable-ros-installation }} GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} @@ -295,6 +300,7 @@ runs: SLIM_BUILD_ARGS: ${{ inputs.slim-build-args }} ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }} RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} + RMW_ZENOH_GIT_REF: ${{ inputs.rmw-zenoh-git-ref }} ROS_DISTRO: ${{ inputs.ros-distro }} DISABLE_ROS_INSTALLATION: ${{ inputs.disable-ros-installation }} GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} @@ -336,6 +342,7 @@ runs: SLIM_BUILD_ARGS: ${{ inputs.slim-build-args }} ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }} RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} + RMW_ZENOH_GIT_REF: ${{ inputs.rmw-zenoh-git-ref }} ROS_DISTRO: ${{ inputs.ros-distro }} DISABLE_ROS_INSTALLATION: ${{ inputs.disable-ros-installation }} GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} diff --git a/docker/Dockerfile b/docker/Dockerfile index e0e9535..2dd3e56 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -222,12 +222,19 @@ RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc # install desired ROS 2 middleware ARG RMW_IMPLEMENTATION="rmw_cyclonedds_cpp" ENV RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION} +ARG RMW_ZENOH_GIT_REF="28d917e0532fed6e9703f044662298f2b3553716" 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 && \ + cd /opt/ws_rmw_zenoh/src/rmw_zenoh && \ + git checkout ${RMW_ZENOH_GIT_REF} && \ + cd - && \ if [[ "$(lsb_release -r | awk '{print $2}')" == "22.04" ]]; then \ - git clone https://github.com/eProsima/Fast-CDR.git /opt/ws_rmw_zenoh/src/Fast-CDR ; \ + git clone https://github.com/eProsima/Fast-CDR.git /opt/ws_rmw_zenoh/src/Fast-CDR && \ + cd /opt/ws_rmw_zenoh/src/Fast-CDR && \ + git checkout 2.2.x && \ + cd - ; \ fi && \ rosdep init || true && \ rosdep update --rosdistro $ROS_DISTRO && \ diff --git a/scripts/build.sh b/scripts/build.sh index 0830164..4089b60 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -18,6 +18,7 @@ build_image() { --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 "${RMW_ZENOH_GIT_REF}" ]]; then echo "--build-arg RMW_ZENOH_GIT_REF=${RMW_ZENOH_GIT_REF}"; 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) \ diff --git a/scripts/ci.sh b/scripts/ci.sh index 8679a10..6d0bf51 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -26,6 +26,7 @@ ENABLE_SLIM="${ENABLE_SLIM:-true}" SLIM_BUILD_ARGS="${SLIM_BUILD_ARGS:-'--sensor-ipc-mode proxy --continue-after=10 --show-clogs --http-probe=false'}" ENABLE_SINGLEARCH_PUSH="${ENABLE_SINGLEARCH_PUSH:-false}" RMW_IMPLEMENTATION="${RMW_IMPLEMENTATION:-}" +RMW_ZENOH_GIT_REF="${RMW_ZENOH_GIT_REF:-}" ROS_DISTRO="${ROS_DISTRO:-}" DISABLE_ROS_INSTALLATION="${DISABLE_ROS_INSTALLATION:-}" GIT_HTTPS_SERVER="${GIT_HTTPS_SERVER:-}" From 30d5390ab7a8c2e34c8910e00924261b6e07390f Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 19 Nov 2024 21:43:22 +0000 Subject: [PATCH 2/3] fix typo in action inputs --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4059735..acf76cd 100644 --- a/action.yml +++ b/action.yml @@ -62,7 +62,7 @@ inputs: description: "RMW implementation to use (only for ROS 2)" default: rmw_cyclonedds_cpp - rmw-implementation: + rmw-zenoh-git-ref: description: "Git ref of rmw_zenoh repo to build if `RMW_IMPLEMENTATION=rmw_zenoh_cpp`" default: 28d917e0532fed6e9703f044662298f2b3553716 From 0e805b352ff94fcdeeb404c5b09873ba85c78c95 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Wed, 20 Nov 2024 09:41:26 +0100 Subject: [PATCH 3/3] simplify cloning of fast-cdr Co-authored-by: Jean-Pierre Busch --- docker/Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2dd3e56..c3c9693 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -231,10 +231,7 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ git checkout ${RMW_ZENOH_GIT_REF} && \ cd - && \ if [[ "$(lsb_release -r | awk '{print $2}')" == "22.04" ]]; then \ - git clone https://github.com/eProsima/Fast-CDR.git /opt/ws_rmw_zenoh/src/Fast-CDR && \ - cd /opt/ws_rmw_zenoh/src/Fast-CDR && \ - git checkout 2.2.x && \ - cd - ; \ + git clone -b 2.2.x https://github.com/eProsima/Fast-CDR.git /opt/ws_rmw_zenoh/src/Fast-CDR ; \ fi && \ rosdep init || true && \ rosdep update --rosdistro $ROS_DISTRO && \