From 5e23d3550614a477a7abfa4587a2da1f77d9ad4e Mon Sep 17 00:00:00 2001 From: David Vadovszki Date: Mon, 2 Nov 2026 21:20:14 +0000 Subject: [PATCH 1/3] fix: stop the workspace template from enabling coverage builds The shipped colcon-defaults.yaml turned on coverage-gcc and coverage-pytest for every build. coverage-pytest sets AMENT_CMAKE_PYTEST_WITH_COVERAGE, and the MoveIt Pro runtime image does not include pytest-cov, so every ament_add_pytest_test call warned at configure time. coverage-gcc instrumented every library and Behavior plugin, which slows builds and can slow multithreaded code at runtime. Drop both mixins to match the defaults MoveIt Pro itself installs for the runtime user, document how to opt back in, and add a pre-commit hook that rejects coverage mixins in the template. Also COPY the defaults file with --chown so it belongs to the workspace user regardless of the host checkout's mode, including runs that skip the entrypoint's home directory chown. Same change as PickNikRobotics/moveit_pro_example_ws for v10.2. Refs PickNikRobotics/moveit_pro#23957 --- .pre-commit-config.yaml | 12 ++++++++++++ Dockerfile | 7 ++++++- colcon-defaults.yaml | 10 ++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 954131d01..f24e2aafd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -88,3 +88,15 @@ repos: - "prettier@3.1.0" - "@prettier/plugin-xml@3.3.1" files: \.(xml)$ + + - repo: local + hooks: + - id: no-coverage-mixins + name: Keep coverage mixins out of the workspace colcon defaults + description: >- + The MoveIt Pro image ships without pytest-cov, so coverage-pytest + makes every ament_add_pytest_test warn. Opt in through + COLCON_DEFAULTS_FILE instead. + entry: '^\s*-\s*coverage-' + language: pygrep + files: ^colcon-defaults\.yaml$ diff --git a/Dockerfile b/Dockerfile index 56c01daa6..a04128002 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,7 +80,12 @@ RUN colcon mixin add default \ colcon metadata add default \ https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \ colcon metadata update -COPY colcon-defaults.yaml /home/${USERNAME}/.colcon/defaults.yaml +# Own the file as the workspace user. A plain COPY keeps the host checkout's +# mode and makes root the owner, so a checkout whose files are mode 0640 (for +# example, umask 0027) leaves colcon unable to read its defaults until the +# entrypoint re-chowns the home directory. Runs that skip the entrypoint, such +# as docker run --entrypoint, would otherwise build without these defaults. +COPY --chown=${USER_UID}:${USER_GID} colcon-defaults.yaml /home/${USERNAME}/.colcon/defaults.yaml # hadolint ignore=DL3002 USER root diff --git a/colcon-defaults.yaml b/colcon-defaults.yaml index 9aedbf87e..1d7469b05 100644 --- a/colcon-defaults.yaml +++ b/colcon-defaults.yaml @@ -11,8 +11,14 @@ build: # Debug info and build testing for dev workflows - rel-with-deb-info - build-testing-on - - coverage-gcc - - coverage-pytest + # No coverage mixins, like the colcon defaults MoveIt Pro installs for + # the runtime user. coverage-pytest forces AMENT_CMAKE_PYTEST_WITH_COVERAGE + # on, and the MoveIt Pro image ships without pytest-cov, so every + # ament_add_pytest_test call warns at configure time. coverage-gcc + # instruments every library, Behavior plugins included, which slows builds + # and can slow multithreaded code at runtime. To collect coverage, copy + # this file, add the mixin you want, and point COLCON_DEFAULTS_FILE at the + # copy; --mixin replaces this list rather than extending it. test: event-handlers: - console_direct+ From f6f7d47bacbe4c97d7dcbbe055e5e0a8ae166835 Mon Sep 17 00:00:00 2001 From: David Vadovszki Date: Mon, 2 Nov 2026 21:31:11 +0000 Subject: [PATCH 2/3] fix: catch quoted and flow-style coverage mixins in the pre-commit hook --- .pre-commit-config.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f24e2aafd..35b82953e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -97,6 +97,8 @@ repos: The MoveIt Pro image ships without pytest-cov, so coverage-pytest makes every ament_add_pytest_test warn. Opt in through COLCON_DEFAULTS_FILE instead. - entry: '^\s*-\s*coverage-' + # Any coverage- outside a comment, so block, flow, and quoted forms + # are all caught. + entry: '^[^#]*coverage-' language: pygrep files: ^colcon-defaults\.yaml$ From 80289d401eb37791c850ce14917774e3343f1f6a Mon Sep 17 00:00:00 2001 From: David Vadovszki Date: Mon, 2 Nov 2026 22:17:20 +0000 Subject: [PATCH 3/3] docs: shorten the coverage and chown comments to one line --- .pre-commit-config.yaml | 8 ++------ Dockerfile | 6 +----- colcon-defaults.yaml | 9 +-------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 35b82953e..fb08359af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -93,12 +93,8 @@ repos: hooks: - id: no-coverage-mixins name: Keep coverage mixins out of the workspace colcon defaults - description: >- - The MoveIt Pro image ships without pytest-cov, so coverage-pytest - makes every ament_add_pytest_test warn. Opt in through - COLCON_DEFAULTS_FILE instead. - # Any coverage- outside a comment, so block, flow, and quoted forms - # are all caught. + description: Coverage stays off in the template. Opt in through COLCON_DEFAULTS_FILE. + # Matches coverage- anywhere outside a comment, including quoted and flow-style entries. entry: '^[^#]*coverage-' language: pygrep files: ^colcon-defaults\.yaml$ diff --git a/Dockerfile b/Dockerfile index a04128002..fe84f603a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,11 +80,7 @@ RUN colcon mixin add default \ colcon metadata add default \ https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \ colcon metadata update -# Own the file as the workspace user. A plain COPY keeps the host checkout's -# mode and makes root the owner, so a checkout whose files are mode 0640 (for -# example, umask 0027) leaves colcon unable to read its defaults until the -# entrypoint re-chowns the home directory. Runs that skip the entrypoint, such -# as docker run --entrypoint, would otherwise build without these defaults. +# --chown lets colcon read the defaults even when the entrypoint has not re-chowned $HOME yet. COPY --chown=${USER_UID}:${USER_GID} colcon-defaults.yaml /home/${USERNAME}/.colcon/defaults.yaml # hadolint ignore=DL3002 diff --git a/colcon-defaults.yaml b/colcon-defaults.yaml index 1d7469b05..d8c5802fe 100644 --- a/colcon-defaults.yaml +++ b/colcon-defaults.yaml @@ -11,14 +11,7 @@ build: # Debug info and build testing for dev workflows - rel-with-deb-info - build-testing-on - # No coverage mixins, like the colcon defaults MoveIt Pro installs for - # the runtime user. coverage-pytest forces AMENT_CMAKE_PYTEST_WITH_COVERAGE - # on, and the MoveIt Pro image ships without pytest-cov, so every - # ament_add_pytest_test call warns at configure time. coverage-gcc - # instruments every library, Behavior plugins included, which slows builds - # and can slow multithreaded code at runtime. To collect coverage, copy - # this file, add the mixin you want, and point COLCON_DEFAULTS_FILE at the - # copy; --mixin replaces this list rather than extending it. + # Coverage is off because the image lacks pytest-cov and gcov slows builds. Opt in through COLCON_DEFAULTS_FILE. test: event-handlers: - console_direct+