From d8c01514ac79646d30aec67100e59adaf99f351d Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Fri, 11 Sep 2026 14:10:22 -0700 Subject: [PATCH] feat(ros2): add Humble development images and distro releases (#28684) * feat(ros2): add Humble development images and distro releases Build Humble on Jammy without replacing its ROS DDS libraries: Agent 2.4.3 links private, pinned Fast DDS/CDR dependencies. Publish Humble and Jazzy tags independently while leaving packaged runtime images Jazzy-only. Assisted-by: Copilot:gpt-6-astra * refactor(ros2): share pinned Agent DDS libraries across distros Build the Agent against the same private Fast DDS and Fast CDR pins on Humble and Jazzy, without replacing either ROS underlay. Remove distro-specific build branches and name the dependency manifest for its shared role. Assisted-by: Copilot:gpt-6-astra --- .github/workflows/ros_dev_container.yml | 59 +++++++++++++------ Tools/packaging/containers/Dockerfile.ros2 | 47 ++++++++++++--- Tools/packaging/containers/docker-bake.hcl | 17 +++++- Tools/packaging/containers/prepare_context.sh | 1 + Tools/packaging/containers/ros2-agent.repos | 9 +++ .../containers/ros2-dev-entrypoint.sh | 2 +- .../containers/ros2-install-dependencies.sh | 18 ++++-- docs/en/dev_setup/sitl_container_builds.md | 52 +++++++++------- .../simulation/px4_sitl_prebuilt_packages.md | 6 +- 9 files changed, 153 insertions(+), 58 deletions(-) create mode 100644 Tools/packaging/containers/ros2-agent.repos diff --git a/.github/workflows/ros_dev_container.yml b/.github/workflows/ros_dev_container.yml index dee33a1c72f..056b2772e5e 100644 --- a/.github/workflows/ros_dev_container.yml +++ b/.github/workflows/ros_dev_container.yml @@ -14,9 +14,9 @@ on: workflow_dispatch: inputs: tag: - description: 'PX4/ROS development tag (e.g. main-jazzy or v1.18-jazzy)' + description: 'Tag prefix for both distros (e.g. main or v1.18; no ROS suffix)' type: string - default: main-jazzy + default: main build_ref: description: 'Source ref; empty uses the workflow ref' type: string @@ -27,7 +27,7 @@ on: default: false concurrency: - group: ros2-dev-${{ github.ref }}-${{ inputs.tag || 'main-jazzy' }} + group: ros2-dev-${{ github.ref }}-${{ inputs.tag || 'main' }} cancel-in-progress: true permissions: @@ -36,11 +36,13 @@ permissions: jobs: build: - name: Build ROS Development Image (${{ matrix.arch }}) + name: Build ROS Development Image (${{ matrix.ros_distro }}, ${{ matrix.arch }}) runs-on: [runs-on,"runner=8cpu-linux-${{ matrix.runner }}","image=ubuntu24-full-${{ matrix.runner }}","run-id=${{ github.run_id }}",extras=s3-cache,spot=false] strategy: fail-fast: false matrix: + ros_distro: [humble, jazzy] + arch: [amd64, arm64] include: - { arch: amd64, runner: x64 } - { arch: arm64, runner: arm64 } @@ -57,20 +59,31 @@ jobs: - name: Resolve source revision id: revision - run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + env: + TAG_PREFIX: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.ref_name || inputs.tag || 'main' }} + run: | + # Reserve seven characters of Docker's 128-character limit for -humble. + if [[ ! "$TAG_PREFIX" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,120}$ ]] || + [[ "$TAG_PREFIX" == *-humble || "$TAG_PREFIX" == *-jazzy ]]; then + echo "Use a tag prefix without a ROS suffix, e.g. main or v1.18" >&2 + exit 1 + fi + echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - uses: docker/login-action@v4 if: >- - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || - (github.event_name == 'workflow_dispatch' && inputs.deploy_to_registry == true) + github.repository == 'PX4/PX4-Autopilot' && + ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || + (github.event_name == 'workflow_dispatch' && inputs.deploy_to_registry == true)) with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - uses: docker/login-action@v4 if: >- - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || - (github.event_name == 'workflow_dispatch' && inputs.deploy_to_registry == true) + github.repository == 'PX4/PX4-Autopilot' && + ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || + (github.event_name == 'workflow_dispatch' && inputs.deploy_to_registry == true)) with: registry: ghcr.io username: ${{ github.actor }} @@ -84,28 +97,35 @@ jobs: uses: docker/bake-action@v7 env: ARCH: ${{ matrix.arch }} + ROS_DISTRO: ${{ matrix.ros_distro }} CACHE_GHA: "true" with: source: . files: Tools/packaging/containers/docker-bake.hcl targets: ros2-dev push: >- - ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || - (github.event_name == 'workflow_dispatch' && inputs.deploy_to_registry == true) }} + ${{ github.repository == 'PX4/PX4-Autopilot' && + ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || + (github.event_name == 'workflow_dispatch' && inputs.deploy_to_registry == true)) }} sbom: true provenance: false set: | - ros2-dev.tags=ghcr.io/px4/px4-dev-ros2:sha-${{ steps.revision.outputs.sha }}-jazzy-${{ matrix.arch }} - ros2-dev.tags=px4io/px4-dev-ros2:sha-${{ steps.revision.outputs.sha }}-jazzy-${{ matrix.arch }} + ros2-dev.tags=ghcr.io/px4/px4-dev-ros2:sha-${{ steps.revision.outputs.sha }}-${{ matrix.ros_distro }}-${{ matrix.arch }} + ros2-dev.tags=px4io/px4-dev-ros2:sha-${{ steps.revision.outputs.sha }}-${{ matrix.ros_distro }}-${{ matrix.arch }} ros2-dev.labels.org.opencontainers.image.source=https://github.com/PX4/PX4-Autopilot ros2-dev.labels.org.opencontainers.image.revision=${{ steps.revision.outputs.sha }} deploy: - name: Publish Multi-Architecture ROS Development Image + name: Publish Multi-Architecture ROS Development Image (${{ matrix.ros_distro }}) needs: build if: >- - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || - (github.event_name == 'workflow_dispatch' && inputs.deploy_to_registry == true) + github.repository == 'PX4/PX4-Autopilot' && + ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || + (github.event_name == 'workflow_dispatch' && inputs.deploy_to_registry == true)) + strategy: + fail-fast: false + matrix: + ros_distro: [humble, jazzy] runs-on: [runs-on,"runner=1cpu-linux-x64","image=ubuntu24-full-x64","run-id=${{ github.run_id }}",extras=s3-cache,spot=false] steps: - uses: runs-on/action@v2 @@ -121,13 +141,14 @@ jobs: - uses: docker/setup-buildx-action@v4 - name: Assemble image and SBOM indexes env: - TAG: ${{ github.event_name == 'push' && format('{0}-jazzy', github.ref_name) || inputs.tag || 'main-jazzy' }} + TAG_PREFIX: ${{ github.event_name == 'push' && github.ref_name || inputs.tag || 'main' }} + ROS_DISTRO: ${{ matrix.ros_distro }} REVISION: ${{ needs.build.outputs.revision }} run: | for REGISTRY in px4io ghcr.io/px4; do IMAGE="${REGISTRY}/px4-dev-ros2" docker buildx imagetools create \ - --tag "${IMAGE}:${TAG}" --tag "${IMAGE}:sha-${REVISION}-jazzy" \ - "${IMAGE}:sha-${REVISION}-jazzy-amd64" "${IMAGE}:sha-${REVISION}-jazzy-arm64" + --tag "${IMAGE}:${TAG_PREFIX}-${ROS_DISTRO}" --tag "${IMAGE}:sha-${REVISION}-${ROS_DISTRO}" \ + "${IMAGE}:sha-${REVISION}-${ROS_DISTRO}-amd64" "${IMAGE}:sha-${REVISION}-${ROS_DISTRO}-arm64" done diff --git a/Tools/packaging/containers/Dockerfile.ros2 b/Tools/packaging/containers/Dockerfile.ros2 index 59e0567ee89..a0f42863c66 100644 --- a/Tools/packaging/containers/Dockerfile.ros2 +++ b/Tools/packaging/containers/Dockerfile.ros2 @@ -1,9 +1,13 @@ # syntax=docker/dockerfile:1 # Build ROS independently of the changing SIH/Gazebo firmware package. -FROM ubuntu:24.04 AS ros2-base +ARG ROS_DISTRO=jazzy +FROM ubuntu:22.04 AS ros2-base-humble +FROM ubuntu:24.04 AS ros2-base-jazzy +FROM ros2-base-${ROS_DISTRO} AS ros2-base +ARG ROS_DISTRO ENV DEBIAN_FRONTEND=noninteractive -ENV ROS_DISTRO=jazzy +ENV ROS_DISTRO=${ROS_DISTRO} ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 @@ -16,15 +20,43 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=bind,source=ros2-install-dependencies.sh,target=/ros2-install-dependencies.sh \ bash /ros2-install-dependencies.sh -# Use Jazzy's Fast DDS/CDR and the Agent's pinned, statically linked logger. -FROM ros2-base AS agent +# Keep ROS libraries intact and statically link the same pinned, private +# Fast DDS/CDR dependencies into the Agent on both distributions. +FROM ros2-base AS agent-dds +ARG BUILD_JOBS=8 +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + apt-get update && apt-get install -y --no-install-recommends libasio-dev libtinyxml2-dev +RUN --mount=type=bind,source=ros2-agent.repos,target=/agent-dependencies.repos \ + source "/opt/ros/${ROS_DISTRO}/setup.bash" \ + && mkdir -p /opt/agent-dds-source /opt/agent-install/usr/local/share/micro-xrce-dds-agent \ + && vcs import /opt/agent-dds-source < /agent-dependencies.repos \ + && vcs export --exact /opt/agent-dds-source \ + > /opt/agent-install/usr/local/share/micro-xrce-dds-agent/dependencies.repos \ + && for dependency in fastcdr fastdds; do \ + cmake -S "/opt/agent-dds-source/${dependency}" -B "/opt/agent-dds-source/${dependency}/build" \ + -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_INSTALL_PREFIX=/opt/agent-dds -DCMAKE_PREFIX_PATH=/opt/agent-dds \ + -DCOMPILE_TOOLS=OFF -DSECURITY=OFF -DSHM_TRANSPORT_DEFAULT=OFF \ + && cmake --build "/opt/agent-dds-source/${dependency}/build" --parallel "${BUILD_JOBS}" \ + && cmake --install "/opt/agent-dds-source/${dependency}/build" \ + && cp "/opt/agent-dds-source/${dependency}/LICENSE" \ + "/opt/agent-install/usr/local/share/micro-xrce-dds-agent/${dependency}-LICENSE" \ + || exit 1; \ + done \ + && rm -rf /opt/agent-dds-source + +FROM agent-dds AS agent ARG XRCE_AGENT_REF=73622810d984349b80bbac0ef55fc0b694d62222 ARG BUILD_JOBS=8 -RUN source /opt/ros/jazzy/setup.bash \ +RUN source "/opt/ros/${ROS_DISTRO}/setup.bash" \ && git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git /opt/agent-source \ && git -C /opt/agent-source checkout "${XRCE_AGENT_REF}" \ && cmake -S /opt/agent-source -B /opt/agent-source/build \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=/opt/agent-dds \ + -DBUILD_SHARED_LIBS=OFF \ -DUAGENT_USE_SYSTEM_FASTDDS=ON \ -DUAGENT_USE_SYSTEM_FASTCDR=ON \ -DUAGENT_P2P_PROFILE=OFF \ @@ -57,9 +89,9 @@ FROM ros2-base AS ros2-dependencies RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ --mount=type=bind,from=ros2-sources,source=/opt/px4_ros2/src,target=/ros_sources \ - source /opt/ros/jazzy/setup.bash \ + source "/opt/ros/${ROS_DISTRO}/setup.bash" \ && apt-get update \ - && rosdep install --from-paths /ros_sources --ignore-src --rosdistro jazzy -y + && rosdep install --from-paths /ros_sources --ignore-src --rosdistro "${ROS_DISTRO}" -y # Standalone development toolchain: no source checkouts, firmware or overlay. FROM ros2-dependencies AS ros2-dev @@ -72,6 +104,7 @@ CMD ["/bin/bash"] # Definitions come from the same checkout as the parent image's PX4 package. FROM ros2-dependencies AS ros2-builder +RUN test "${ROS_DISTRO}" = jazzy || { echo "SITL runtime images support only Jazzy" >&2; exit 1; } WORKDIR /opt/px4_ros2 COPY --from=ros2-sources /opt/px4_ros2/ /opt/px4_ros2/ COPY px4_msgs/ src/px4_msgs/ diff --git a/Tools/packaging/containers/docker-bake.hcl b/Tools/packaging/containers/docker-bake.hcl index a4bccc98ce3..00289b5d249 100644 --- a/Tools/packaging/containers/docker-bake.hcl +++ b/Tools/packaging/containers/docker-bake.hcl @@ -14,6 +14,14 @@ variable "CACHE_GHA" { default = false } +variable "ROS_DISTRO" { + default = "jazzy" + validation { + condition = contains(["humble", "jazzy"], ROS_DISTRO) + error_message = "ROS_DISTRO must be humble or jazzy." + } +} + variable "REPOSITORY" { default = SIMULATOR == "sih" ? "px4-sitl" : "px4-sitl-gazebo" } @@ -61,7 +69,10 @@ target "ros2-dev" { platforms = ["linux/${ARCH}"] dockerfile = "Dockerfile.ros2" target = "ros2-dev" - tags = ["px4io/px4-dev-ros2:main-jazzy-${ARCH}", "ghcr.io/px4/px4-dev-ros2:main-jazzy-${ARCH}"] - cache-from = CACHE_GHA ? ["type=gha,scope=ros2-dev-${ARCH}"] : [] - cache-to = CACHE_GHA ? ["type=gha,mode=max,scope=ros2-dev-${ARCH}"] : [] + args = { + ROS_DISTRO = ROS_DISTRO + } + tags = ["px4io/px4-dev-ros2:main-${ROS_DISTRO}-${ARCH}", "ghcr.io/px4/px4-dev-ros2:main-${ROS_DISTRO}-${ARCH}"] + cache-from = CACHE_GHA ? ["type=gha,scope=ros2-dev-${ROS_DISTRO}-${ARCH}"] : [] + cache-to = CACHE_GHA ? ["type=gha,mode=max,scope=ros2-dev-${ROS_DISTRO}-${ARCH}"] : [] } diff --git a/Tools/packaging/containers/prepare_context.sh b/Tools/packaging/containers/prepare_context.sh index 13e2b546e12..6baab6a62e2 100644 --- a/Tools/packaging/containers/prepare_context.sh +++ b/Tools/packaging/containers/prepare_context.sh @@ -15,6 +15,7 @@ else mkdir -p "$context_dir/setup" cp "$script_dir"/Dockerfile.* "$script_dir"/*entrypoint.sh "$script_dir/px4-network.sh" "$context_dir/" cp "$script_dir/ros2-install-dependencies.sh" "$repo_dir/Tools/ros2/ros2.repos" "$context_dir/" + cp "$script_dir/ros2-agent.repos" "$context_dir/" cp "$repo_dir/Tools/setup/ubuntu.sh" "$repo_dir/Tools/setup/requirements.txt" "$context_dir/setup/" fi diff --git a/Tools/packaging/containers/ros2-agent.repos b/Tools/packaging/containers/ros2-agent.repos new file mode 100644 index 00000000000..e568fbc9d81 --- /dev/null +++ b/Tools/packaging/containers/ros2-agent.repos @@ -0,0 +1,9 @@ +repositories: + fastcdr: + type: git + url: https://github.com/eProsima/Fast-CDR.git + version: 1bc9c919311ffce555b445560bf7ae062a4e1c72 # v2.2.8 + fastdds: + type: git + url: https://github.com/eProsima/Fast-DDS.git + version: 010b908dc3bb2b6f2818d61ac8db462d01b79a1f # v2.14.7 diff --git a/Tools/packaging/containers/ros2-dev-entrypoint.sh b/Tools/packaging/containers/ros2-dev-entrypoint.sh index 2fe9e5ebfe5..97f1899864d 100755 --- a/Tools/packaging/containers/ros2-dev-entrypoint.sh +++ b/Tools/packaging/containers/ros2-dev-entrypoint.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -e -source /opt/ros/jazzy/setup.bash +source "/opt/ros/${ROS_DISTRO}/setup.bash" exec "$@" diff --git a/Tools/packaging/containers/ros2-install-dependencies.sh b/Tools/packaging/containers/ros2-install-dependencies.sh index 401763de400..6abb8490240 100644 --- a/Tools/packaging/containers/ros2-install-dependencies.sh +++ b/Tools/packaging/containers/ros2-install-dependencies.sh @@ -1,19 +1,25 @@ #!/usr/bin/env bash set -euo pipefail +source /etc/os-release +case "${VERSION_CODENAME}:${ROS_DISTRO}" in + jammy:humble|noble:jazzy) ;; + *) echo "Unsupported Ubuntu/ROS pair: ${VERSION_CODENAME}/${ROS_DISTRO}" >&2; exit 1 ;; +esac + rm -f /etc/apt/apt.conf.d/docker-clean apt-get update apt-get install -y --no-install-recommends ca-certificates curl -curl -fsSL "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.noble_all.deb" \ +curl -fsSL "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.${VERSION_CODENAME}_all.deb" \ -o /ros2-apt-source.deb apt-get install -y --no-install-recommends /ros2-apt-source.deb rm /ros2-apt-source.deb apt-get update apt-get install -y --no-install-recommends \ build-essential ccache cmake git ninja-build \ - python3-empy python3-pip ros-dev-tools ros-jazzy-ros-base + python3-empy python3-pip ros-dev-tools "ros-${ROS_DISTRO}-ros-base" -# Keep Ubuntu/Jazzy's Python packages while satisfying PX4's shared requirements. +# Keep Ubuntu/ROS Python packages while satisfying PX4's shared requirements. # Distro-only versions (e.g. ubuntu suffixes) cannot be pip constraints. python3 - <<'PY' > /px4-python-constraints.txt from importlib.metadata import distributions @@ -33,10 +39,10 @@ RUNS_IN_DOCKER=true PIP_CONSTRAINT=/px4-python-constraints.txt PIP_NO_CACHE_DIR= rm /px4-python-constraints.txt rosdep init -rosdep update --rosdistro jazzy +rosdep update --rosdistro "${ROS_DISTRO}" if [ "$#" -gt 0 ]; then # ROS setup scripts are not nounset-safe. set +u - source /opt/ros/jazzy/setup.bash - rosdep install --from-paths "$1" --ignore-src --rosdistro jazzy -y + source "/opt/ros/${ROS_DISTRO}/setup.bash" + rosdep install --from-paths "$1" --ignore-src --rosdistro "${ROS_DISTRO}" -y fi diff --git a/docs/en/dev_setup/sitl_container_builds.md b/docs/en/dev_setup/sitl_container_builds.md index 59f336c4572..1efde29934a 100644 --- a/docs/en/dev_setup/sitl_container_builds.md +++ b/docs/en/dev_setup/sitl_container_builds.md @@ -19,6 +19,7 @@ Tools/packaging/ *-entrypoint.sh Container startup scripts px4-network.sh Shared runtime host routing ros2-install-dependencies.sh + ros2-agent.repos test_sih_mission.py Tools/ros2/ prepare_workspace.py Checkout-matched ROS source workspace preparation @@ -77,7 +78,7 @@ Repository checkouts live in a separate source stage and are mounted read-only f The development toolchain does not inherit those source layers; only the ROS workspace builder copies the checkouts. Changing only the ROS entrypoint does not rebuild the workspace, and changing only the test command does not recompile it. -The Agent and ROS workspace build in independent Ubuntu 24.04/Jazzy stages, keyed to source pins and the supplied PX4 message definitions rather than the packaged firmware. +For the packaged ROS images, the Agent and ROS workspace build in independent Ubuntu 24.04/Jazzy stages, keyed to source pins and the supplied PX4 message definitions rather than the packaged firmware. A new PX4 binary with unchanged messages reuses those compilation and test layers. Changed messages invalidate workspace compilation and tests; cached artifacts never substitute messages from another checkout. The final image still derives from the connected SIH/Gazebo parent and installs its Ubuntu/ROS dependencies using the same helper as the builder. @@ -108,16 +109,22 @@ Image and workflow SHA overrides are for testing candidates; adopting a candidat ## Testing A PX4 Checkout With ROS -The standalone `ghcr.io/px4/px4-dev-ros2:main-jazzy` image includes Jazzy, the Agent, PX4's source-build dependencies and the dependencies required by the pinned ROS repositories. -It is also available on Docker Hub as `px4io/px4-dev-ros2:main-jazzy`, with matching tags in both registries. -It contains no repository checkouts, packaged PX4 firmware or compiled ROS workspace, and its entrypoint sources only the Jazzy underlay. -It is published independently of the SITL package workflow, so it does not wait for `.deb` builds. +The standalone `ghcr.io/px4/px4-dev-ros2` image provides Ubuntu 22.04/ROS Humble (`main-humble`) and Ubuntu 24.04/ROS Jazzy (`main-jazzy`) toolchains for native `amd64` and `arm64`. +Both include Micro XRCE-DDS Agent v2.4.3, PX4's source-build dependencies and the dependencies required by the pinned ROS repositories. +They are also available on Docker Hub as `px4io/px4-dev-ros2`, with matching tags in both registries. +They contain no repository checkouts, packaged PX4 firmware or compiled ROS workspace, and their entrypoint sources only the selected ROS underlay. +The packaged SIH/Gazebo ROS images remain Ubuntu 24.04/Jazzy only. +Both Agent builds statically link the same private Fast DDS 2.14.7/Fast CDR 2.2.8 dependencies pinned in `Tools/packaging/containers/ros2-agent.repos`. +This provides one controlled Agent dependency set across both distros and avoids Humble's Fast CDR 1.x build incompatibility with Agent v2.4.3. +Their resolved revisions and licences are retained under `/usr/local/share/micro-xrce-dds-agent`; neither distro's ROS libraries are replaced. +The packaged Jazzy ROS images reuse this Agent build. +These toolchains are published independently of the SITL package workflow, so they do not wait for `.deb` builds. Publishing follows the same release-tag and opt-in manual policy as `px4-dev`. -The `main-jazzy` tag names the manually published toolchain for PX4 `main` development with ROS Jazzy, not bundled firmware. -Pushing a `v*` Git tag publishes `-jazzy`, such as `v1.18.0-jazzy`, without updating `main-jazzy`. -Each publication also provides `sha--jazzy`, identifying the repository revision used to build the toolchain. -Release-line toolchains can use tags such as `v1.18-jazzy` through the manual publisher's `tag` input when that release line is maintained. +The `main-humble` and `main-jazzy` tags name manually published toolchains for PX4 `main` development, not bundled firmware. +Pushing a `v*` Git tag publishes both `-humble` and `-jazzy`, such as `v1.18.0-humble` and `v1.18.0-jazzy`, retaining the leading `v` without updating either `main-*` tag. +Each publication also provides `sha--`, identifying the repository revision used to build the toolchain. +Release-line toolchains can use tags such as `v1.18-humble` and `v1.18-jazzy` through the manual publisher's `tag` prefix input (`v1.18`) when that release line is maintained. The source revision and intended PX4 release line do not change which firmware a checkout builds. ROS integration CI pins the image by digest so publishing a new moving tag cannot silently change the test environment. When adopting a rebuilt toolchain, update the digest in `.github/workflows/ros_integration_tests.yml`. @@ -126,7 +133,7 @@ The optional `ros2-dev` Bake target builds this image without `.deb` packages or ```sh bash Tools/packaging/containers/prepare_context.sh -docker buildx bake -f Tools/packaging/containers/docker-bake.hcl ros2-dev \ +ROS_DISTRO=humble docker buildx bake -f Tools/packaging/containers/docker-bake.hcl ros2-dev \ --set ros2-dev.tags=px4-dev-ros2:local --load SOURCE=$(pwd -P) GIT_COMMON_DIR=$(git rev-parse --path-format=absolute --git-common-dir) @@ -137,19 +144,22 @@ docker run --rm -it \ ``` The same absolute mounts support both ordinary checkouts and git worktrees. +Set `ROS_DISTRO=jazzy` instead, or omit it, for the default Jazzy developer image. +Bake selects the matching Ubuntu base; only `humble` and `jazzy` are supported. +This selection applies only to `ros2-dev`, not the packaged runtime targets. The Git ownership exception is scoped to this container and checkout. Inside the container, build the current checkout; the build initialises its required submodules: ```bash PX4_DIR=$PWD make px4_sitl_sih -source /opt/ros/jazzy/setup.bash +source "/opt/ros/$ROS_DISTRO/setup.bash" python3 Tools/ros2/prepare_workspace.py /opt/px4_ros2_ci cd /opt/px4_ros2_ci sudo apt-get update -qq -rosdep update --rosdistro jazzy -rosdep install --from-paths src --ignore-src --rosdistro jazzy -y -colcon build --symlink-install --cmake-args \ +rosdep update --rosdistro "$ROS_DISTRO" +rosdep install --from-paths src --ignore-src --rosdistro "$ROS_DISTRO" -y +CMAKE_BUILD_PARALLEL_LEVEL=8 colcon build --symlink-install --executor sequential --cmake-args \ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON \ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache colcon test --packages-select px4_ros2_cpp --ctest-args -R unit_tests @@ -172,15 +182,17 @@ Its manual `px4_ros2_ref` input selects a full interface-library commit SHA; lea CI prepares and builds the ROS workspace on every run using the current checkout's message/service definitions. Only the compiler cache is restored, not an old source, build or install workspace. Ccache validates compiler contents and compilation inputs, including changed library sources and generated messages. -`CACHE_GHA=true` uses an independent `ros2-dev-` image cache, without replacing the published SITL image caches. -The `ros_dev_container.yml` workflow builds the standalone target on every `main` push and on pull requests that change its watched paths, without publishing. -It publishes to Docker Hub and GHCR only on `v*` tag pushes or manual runs with `deploy_to_registry=true`. -Manual runs use the `tag` input, which defaults to `main-jazzy`; the deployment toggle also applies when dispatching against a Git tag. -Architecture tags use `sha--jazzy-`; the final selected tag and `sha--jazzy` indexes preserve both architectures and their SBOMs. +`CACHE_GHA=true` uses an independent `ros2-dev--` image cache, without replacing the published SITL image caches. +The `ros_dev_container.yml` workflow builds both standalone variants on every `main` push and on pull requests that change its watched paths, without publishing. +In the upstream repository, it publishes to Docker Hub and GHCR only on `v*` tag pushes or authorised manual runs with `deploy_to_registry=true`. +Manual runs build both distros and now take a distro-independent `tag` prefix, defaulting to `main`, rather than a complete tag such as `main-jazzy`. +Use `main` to publish `main-humble` and `main-jazzy`, or `v1.18` to publish `v1.18-humble` and `v1.18-jazzy`; ROS-suffixed inputs are rejected to avoid mislabelling images. +The existing `build_ref` selects the source revision, and the deployment toggle also applies when dispatching against a Git tag. +Architecture tags use `sha---`; each distro's selected tag and `sha--` indexes preserve its two architectures and their SBOMs. Use `--set ros2-dev.args.PX4_ROS2_REF=<40-hex-SHA>` to build the development image with another interface-library commit. Both ROS development images and the CI toolchain reuse `Tools/setup/ubuntu.sh --no-nuttx --no-sim-tools` and its Python requirements. -Already installed Ubuntu/Jazzy Python versions are constrained during installation instead of gratuitously upgrading the ROS stack. +Already installed Ubuntu/ROS Python versions are constrained during installation instead of gratuitously upgrading the ROS stack. The SIH image does not acquire Gazebo or the NuttX toolchain. Installing the complete source-build toolset increases cold image-build time and size; existing native architecture and incremental cache boundaries remain in use. diff --git a/docs/en/simulation/px4_sitl_prebuilt_packages.md b/docs/en/simulation/px4_sitl_prebuilt_packages.md index d68cc902170..b7f61105ddf 100644 --- a/docs/en/simulation/px4_sitl_prebuilt_packages.md +++ b/docs/en/simulation/px4_sitl_prebuilt_packages.md @@ -175,8 +175,10 @@ Host ROS nodes require additional DDS networking configuration; the example keep When testing modified PX4 firmware, rebuild the ROS workspace against its message definitions rather than using the bundled library. Use `--entrypoint /bin/bash` and source `/opt/ros/jazzy/setup.bash` to start without the bundled workspace. For source builds and selecting an interface-library commit, see [Testing A PX4 Checkout With ROS](../dev_setup/sitl_container_builds.md#testing-a-px4-checkout-with-ros). -The standalone `ghcr.io/px4/px4-dev-ros2:main-jazzy` toolchain provides the build tools and ROS dependencies without bundled source checkouts, firmware or a compiled workspace. -It is also available on Docker Hub as `px4io/px4-dev-ros2:main-jazzy`, with matching tags in both registries. +The standalone `ghcr.io/px4/px4-dev-ros2` toolchain provides Ubuntu 22.04/ROS Humble (`main-humble`) and Ubuntu 24.04/ROS Jazzy (`main-jazzy`) variants for `amd64` and `arm64`, without bundled source checkouts, firmware or a compiled workspace. +It is also available on Docker Hub as `px4io/px4-dev-ros2`, with matching distro-qualified tags in both registries. +Release tags retain the Git tag and ROS suffix, for example `v1.18.0-humble` and `v1.18.0-jazzy`; release publication does not move the manually published `main-*` tags. +Humble support is limited to this standalone toolchain; the packaged SIH/Gazebo ROS images above remain Jazzy-only. ROS integration CI uses this toolchain, builds PX4 from the pull request, and regenerates messages from that checkout. #### Go-To Example