Skip to content

ci: Pin Python version in CI workflows to fix colcon test failures#69

Merged
Tiryoh merged 2 commits intomainfrom
fix/ci-python-version
Apr 4, 2026
Merged

ci: Pin Python version in CI workflows to fix colcon test failures#69
Tiryoh merged 2 commits intomainfrom
fix/ci-python-version

Conversation

@Tiryoh
Copy link
Copy Markdown
Owner

@Tiryoh Tiryoh commented Apr 2, 2026

Summary

  • A GitHub Actions runner image update (ubuntu22/20260105.207ubuntu22/20260112.2) 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, which made all rclpy packages fail with exit code 2 during colcon test
  • Fixed by redefining PATH at the workflow level to prioritize /usr/bin over /usr/local/bin, ensuring the system Python is used

What was tried

  1. actions/setup-python to pin the Python version → Installed a separate Python under /opt/hostedtoolcache which lacked ROS 2 dependency packages, resulting in ModuleNotFoundError: No module named 'catkin_pkg' — made things worse
  2. env.PATH to prioritize system Python → Success

Summary by CodeRabbit

  • Chores
    • CI workflows updated to set a global PATH for all jobs, changing which system binaries (including system Python) are resolved during runs.
    • No changes to job steps, install/test commands, or application code—only workflow-level environment configuration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc0b8c5f-d823-4b9b-8c4b-f314e6ea84a6

📥 Commits

Reviewing files that changed from the base of the PR and between ff91932 and 962dd55.

📒 Files selected for processing (3)
  • .github/workflows/eol-installers.yml
  • .github/workflows/installers.yml
  • .github/workflows/main.yml
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/eol-installers.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/installers.yml

📝 Walkthrough

Walkthrough

Set a workflow-level environment PATH in three GitHub Actions workflow files to a fixed value (/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin), affecting command resolution for all jobs and steps. No job steps, triggers, or other logic were changed.

Changes

Cohort / File(s) Summary
Workflow env PATH
.github/workflows/eol-installers.yml, .github/workflows/installers.yml, .github/workflows/main.yml
Added a top-level env block that sets PATH: /usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin for all jobs/steps; no other workflow steps or control flow modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I nibble paths and tidy tracks,
PATH set straight so commands come back.
/usr/bin first, I gently lay,
CI hops steady through the day. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to 'pin Python version' but the actual changes only modify the PATH environment variable in CI workflows without pinning any Python version. Revise the title to accurately reflect the changes, such as 'ci: Override PATH in CI workflows to fix colcon test failures' or 'ci: Set system Python path priority in CI workflows'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-python-version

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PATH so /usr/bin is searched before /usr/local/bin in CI.
  • Apply the same PATH override 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.

Comment on lines +20 to +24
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
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +23
env:
PATH: /usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +28
env:
PATH: /usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin

Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
env:
PATH: /usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin

Copilot uses AI. Check for mistakes.
@Tiryoh Tiryoh merged commit 99db66e into main Apr 4, 2026
18 checks passed
@Tiryoh Tiryoh deleted the fix/ci-python-version branch April 4, 2026 13:47
Tiryoh added a commit that referenced this pull request Apr 4, 2026
…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>
@Tiryoh
Copy link
Copy Markdown
Owner Author

Tiryoh commented Apr 4, 2026

Accidentally merged with a regular merge commit instead of squash merge. Reset main and re-applied as a squash commit: dc3001a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants