ci: Pin Python version in CI workflows to fix colcon test failures#69
ci: Pin Python version in CI workflows to fix colcon test failures#69
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSet a workflow-level environment Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
actions/setup-python installs a separate Python under /opt/hostedtoolcache which lacks ROS 2 dependencies (catkin_pkg, etc.). Instead, reorder PATH to prioritize /usr/bin (system Python) over /usr/local/bin (runner Python). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates GitHub Actions workflows to ensure ROS 2 CI runs use the system Python (/usr/bin/python3) rather than a runner-managed Python that can miss ROS 2 Python dependencies, addressing recent colcon test failures.
Changes:
- Set a workflow-level
PATHso/usr/binis searched before/usr/local/binin CI. - Apply the same
PATHoverride across the main, installers, and EOL installers workflows.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .github/workflows/main.yml | Adds a global PATH override (with explanatory comment) to prefer system Python for ROS 2 tests. |
| .github/workflows/installers.yml | Adds a global PATH override for installer validation jobs. |
| .github/workflows/eol-installers.yml | Adds a global PATH override for EOL installer jobs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| env: | ||
| # Ensure the system Python (/usr/bin/python3) is used instead of | ||
| # the runner-managed one under /usr/local, which may lack ROS 2 | ||
| # Python dependencies such as catkin_pkg. | ||
| PATH: /usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin |
There was a problem hiding this comment.
Setting a fixed PATH here overwrites the runner’s default PATH entries (e.g., toolcache locations). That can unexpectedly break other tools/actions that rely on those directories being present. Prefer prepending /usr/bin ahead of the existing PATH (e.g., via $GITHUB_PATH or an explicit PATH update step) so you only change python resolution without discarding other PATH entries.
| env: | ||
| PATH: /usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin |
There was a problem hiding this comment.
This workflow-level PATH assignment replaces the runner’s default PATH rather than just prioritizing /usr/bin. That can remove important runner-provided directories and cause unrelated steps/tools to fail. Safer approach: prepend /usr/bin ahead of the existing PATH (without hardcoding the full PATH list).
| env: | ||
| PATH: /usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin | ||
|
|
There was a problem hiding this comment.
Overriding PATH to a hardcoded value here drops any runner-added PATH entries. This is fragile and can break steps that depend on those locations. Consider prepending /usr/bin to the existing PATH instead of replacing it entirely.
| env: | |
| PATH: /usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin |
…hon (#69) A GitHub Actions runner image update caused all scheduled CI workflows to fail since 2026-01-19. The runner's /usr/local/bin/python3 took precedence over the system /usr/bin/python3, causing ROS 2 Python dependencies (e.g. catkin_pkg) to not be found. Fixed by redefining PATH at the workflow level to prioritize /usr/bin over /usr/local/bin, ensuring the system Python is used. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Accidentally merged with a regular merge commit instead of squash merge. Reset main and re-applied as a squash commit: dc3001a |
Summary
ubuntu22/20260105.207→ubuntu22/20260112.2) caused all scheduled CI workflows to fail since 2026-01-19/usr/local/bin/python3took precedence over the system/usr/bin/python3, causing ROS 2 Python dependencies (e.g.catkin_pkg) to not be found, which made all rclpy packages fail with exit code 2 duringcolcon testPATHat the workflow level to prioritize/usr/binover/usr/local/bin, ensuring the system Python is usedWhat was tried
actions/setup-pythonto pin the Python version → Installed a separate Python under/opt/hostedtoolcachewhich lacked ROS 2 dependency packages, resulting inModuleNotFoundError: No module named 'catkin_pkg'— made things worseenv.PATHto prioritize system Python → SuccessSummary by CodeRabbit