From 95f972690451f0400323e7be5cb7c73cdd9fdcd7 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Wed, 15 Jan 2025 15:36:25 +0100 Subject: [PATCH 1/3] remove rmw-zenoh build from src --- .gitlab-ci/docker-ros.yml | 5 ----- README.md | 3 --- action.yml | 7 +------ docker/Dockerfile | 24 +----------------------- docker/entrypoint.sh | 1 - scripts/build.sh | 1 - scripts/ci.sh | 1 - 7 files changed, 2 insertions(+), 40 deletions(-) diff --git a/.gitlab-ci/docker-ros.yml b/.gitlab-ci/docker-ros.yml index 4f374f9..edb25e6 100644 --- a/.gitlab-ci/docker-ros.yml +++ b/.gitlab-ci/docker-ros.yml @@ -40,7 +40,6 @@ variables: REGISTRY_USER: ${CI_REGISTRY_USER} # Docker registry username REGISTRY: ${CI_REGISTRY} # Docker registry to push images to RMW_IMPLEMENTATION: 'rmw_cyclonedds_cpp' # RMW implementation to use (only for ROS 2) - RMW_ZENOH_GIT_REF: '' # 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`) SLIM_BUILD_ARGS: '--sensor-ipc-mode proxy --continue-after=10 --show-clogs --http-probe=false' # Arguments to `slim build` (except for `--target` and `--tag`) TARGET: run # Target stage of Dockerfile (comma-separated list) [dev|run] @@ -204,10 +203,6 @@ run-arm64: fi - git clone --branch master --depth 1 https://github.com/ros-industrial/industrial_ci.git .industrial_ci - test -f ${BUILD_CONTEXT}/.repos || echo "repositories:" > ${BUILD_CONTEXT}/.repos - - |- - if [ "$RMW_IMPLEMENTATION" = "rmw_zenoh_cpp" ]; then - export UNDERLAY="/opt/ws_rmw_zenoh/install" - fi script: .industrial_ci/gitlab.sh Test dev-amd64: diff --git a/README.md b/README.md index e2f9501..e5532e8 100644 --- a/README.md +++ b/README.md @@ -466,9 +466,6 @@ 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:* `$ROS_DISTRO` - **`ros-distro` | `ROS_DISTRO`** ROS Distro *required if ROS is not installed in `base-image`* diff --git a/action.yml b/action.yml index 5ff0d68..6c72560 100644 --- a/action.yml +++ b/action.yml @@ -104,8 +104,6 @@ inputs: rmw-implementation: description: "RMW implementation to use (only for ROS 2)" default: rmw_cyclonedds_cpp - rmw-zenoh-git-ref: - description: "Git ref of rmw_zenoh repo to build if `RMW_IMPLEMENTATION=rmw_zenoh_cpp`" slim-build-args: description: "Arguments to `slim build` (except for `--target` and `--tag`)" default: '--sensor-ipc-mode proxy --continue-after=10 --show-clogs --http-probe=false' @@ -207,7 +205,6 @@ runs: IMAGE_TAG: ${{ inputs.image-tag }} PLATFORM: ${{ inputs.platform }} RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} - RMW_ZENOH_GIT_REF: ${{ inputs.rmw-zenoh-git-ref }} ROS_DISTRO: ${{ inputs.ros-distro }} SLIM_BUILD_ARGS: ${{ inputs.slim-build-args }} SLIM_IMAGE_NAME: ${{ steps.slim-image-name.outputs.lowercase }} @@ -225,7 +222,7 @@ runs: uses: ros-industrial/industrial_ci@master env: ADDITIONAL_DEBS: git - AFTER_INIT_EMBED: '[[ "$RMW_IMPLEMENTATION" == "rmw_zenoh_cpp" ]] && export UNDERLAY="/opt/ws_rmw_zenoh/install" ; [[ -n ${{ inputs.git-https-server }} ]] && git config --global url.https://${{ inputs.git-https-user }}:${{ inputs.git-https-password }}@${{ inputs.git-https-server }}.insteadOf https://${{ inputs.git-https-server }}' + AFTER_INIT_EMBED: '[[ -n ${{ inputs.git-https-server }} ]] && git config --global url.https://${{ inputs.git-https-user }}:${{ inputs.git-https-password }}@${{ inputs.git-https-server }}.insteadOf https://${{ inputs.git-https-server }}' DOCKER_IMAGE: ${{ steps.build-images.outputs.INDUSTRIAL_CI_IMAGE }} DOCKER_PULL: false DOCKER_RUN_OPTS: -u root:root @@ -271,7 +268,6 @@ runs: IMAGE_TAG: ${{ inputs.image-tag }} PLATFORM: ${{ inputs.platform }} RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} - RMW_ZENOH_GIT_REF: ${{ inputs.rmw-zenoh-git-ref }} ROS_DISTRO: ${{ inputs.ros-distro }} SLIM_BUILD_ARGS: ${{ inputs.slim-build-args }} SLIM_IMAGE_NAME: ${{ steps.slim-image-name.outputs.lowercase }} @@ -313,7 +309,6 @@ runs: IMAGE_TAG: latest PLATFORM: ${{ inputs.platform }} RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} - RMW_ZENOH_GIT_REF: ${{ inputs.rmw-zenoh-git-ref }} ROS_DISTRO: ${{ inputs.ros-distro }} SLIM_BUILD_ARGS: ${{ inputs.slim-build-args }} SLIM_IMAGE_NAME: ${{ steps.slim-image-name.outputs.lowercase }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 4a01948..8ec9a63 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -222,29 +222,8 @@ RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc # install desired ROS 2 middleware ARG RMW_IMPLEMENTATION ENV RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION:-rmw_cyclonedds_cpp} -ARG RMW_ZENOH_GIT_REF RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ - if [[ "$RMW_IMPLEMENTATION" == "rmw_zenoh_cpp" ]]; then \ - if [[ ! -d /opt/ws_rmw_zenoh/src ]]; 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:-${ROS_DISTRO}} && \ - cd - && \ - if [[ "$(lsb_release -r | awk '{print $2}')" == "22.04" ]]; then \ - 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 && \ - apt-get update && \ - cd /opt/ws_rmw_zenoh && \ - rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO && \ - rm -rf /var/lib/apt/lists/* && \ - source /opt/ros/${ROS_DISTRO}/setup.bash && \ - colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release && \ - echo "source /opt/ws_rmw_zenoh/install/setup.bash" >> ~/.bashrc ; \ - fi ; \ - elif [[ "$ROS_VERSION" == "2" ]]; then \ + if [[ "$ROS_VERSION" == "2" ]]; then \ apt-get update && \ RMW_PACKAGE=ros-$ROS_DISTRO-$(echo $RMW_IMPLEMENTATION | tr '_' '-') && \ apt-get install -y $RMW_PACKAGE && \ @@ -279,7 +258,6 @@ FROM dev AS build # build ROS workspace RUN if [[ -x "$(command -v colcon)" ]]; then \ source /opt/ros/${ROS_DISTRO}/setup.bash && \ - [[ -f /opt/ws_rmw_zenoh/install/setup.bash ]] && source /opt/ws_rmw_zenoh/install/setup.bash ; \ [[ -f /opt/ws_base_image/install/setup.bash ]] && source /opt/ws_base_image/install/setup.bash ; \ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ elif [[ -x "$(command -v catkin)" ]]; then \ diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index be7921c..b68734d 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -3,7 +3,6 @@ set -e # source ROS workspace source /opt/ros/$ROS_DISTRO/setup.bash -[[ -f /opt/ws_rmw_zenoh/install/setup.bash ]] && source /opt/ws_rmw_zenoh/install/setup.bash [[ -f /opt/ws_base_image/install/setup.bash ]] && source /opt/ws_base_image/install/setup.bash [[ -f $WORKSPACE/devel/setup.bash ]] && source $WORKSPACE/devel/setup.bash [[ -f $WORKSPACE/install/setup.bash ]] && source $WORKSPACE/install/setup.bash diff --git a/scripts/build.sh b/scripts/build.sh index b0270c8..d9c2240 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -34,7 +34,6 @@ build_image() { $(if [[ -n "${GIT_SSH_KNOWN_HOST_KEYS}" ]]; then echo "--build-arg GIT_SSH_KNOWN_HOST_KEYS=${GIT_SSH_KNOWN_HOST_KEYS}"; fi) \ $(if [[ -n "${GIT_SSH_PRIVATE_KEY}" ]]; then echo "--build-arg GIT_SSH_PRIVATE_KEY=${GIT_SSH_PRIVATE_KEY}"; fi) \ $(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 "${VCS_IMPORT_FILE}" ]]; then echo "--build-arg VCS_IMPORT_FILE=${VCS_IMPORT_FILE}"; fi) \ . diff --git a/scripts/ci.sh b/scripts/ci.sh index 0dc312a..7987865 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -40,7 +40,6 @@ GIT_SSH_KNOWN_HOST_KEYS="${GIT_SSH_KNOWN_HOST_KEYS:-}" GIT_SSH_PRIVATE_KEY="${GIT_SSH_PRIVATE_KEY:-}" IMAGE="${IMAGE_NAME}:${IMAGE_TAG}" RMW_IMPLEMENTATION="${RMW_IMPLEMENTATION:-}" -RMW_ZENOH_GIT_REF="${RMW_ZENOH_GIT_REF:-}" ROS_DISTRO="${ROS_DISTRO:-}" SLIM_BUILD_ARGS="${SLIM_BUILD_ARGS:-'--sensor-ipc-mode proxy --continue-after=10 --show-clogs --http-probe=false'}" SLIM_IMAGE="${SLIM_IMAGE_NAME}:${SLIM_IMAGE_TAG}" From ed3e273f8331f7810b902ca1d2b9448320a7f083 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Fri, 24 Jan 2025 14:24:05 +0100 Subject: [PATCH 2/3] only install middleware if ROS installation is not disabled via flag --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 8ec9a63..7575c13 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -223,7 +223,7 @@ RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc ARG RMW_IMPLEMENTATION ENV RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION:-rmw_cyclonedds_cpp} RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ - if [[ "$ROS_VERSION" == "2" ]]; then \ + if [[ "$ROS_VERSION" == "2" && "$DISABLE_ROS_INSTALLATION" != "true"]]; then \ apt-get update && \ RMW_PACKAGE=ros-$ROS_DISTRO-$(echo $RMW_IMPLEMENTATION | tr '_' '-') && \ apt-get install -y $RMW_PACKAGE && \ From 73c815e6e51604a52247edfd4cff7edd616effb9 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Fri, 24 Jan 2025 23:31:30 +0100 Subject: [PATCH 3/3] fix condition in dockerfile --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6e9b5df..e1d8597 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -223,7 +223,7 @@ RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc ARG RMW_IMPLEMENTATION ENV RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION:-rmw_cyclonedds_cpp} RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ - if [[ "$ROS_VERSION" == "2" && "$DISABLE_ROS_INSTALLATION" != "true"]]; then \ + if [[ "$ROS_VERSION" == "2" && "$DISABLE_ROS_INSTALLATION" != "true" ]]; then \ apt-get update && \ RMW_PACKAGE=ros-$ROS_DISTRO-$(echo $RMW_IMPLEMENTATION | tr '_' '-') && \ apt-get install -y $RMW_PACKAGE && \