fix: sync Docker runtime Python with builder and harden Renovate config - #628
Conversation
Renovate PR homeassistant-ai#598 bumped the runtime Python image from 3.13 to 3.14 independently of the builder stage, causing ModuleNotFoundError in all three Docker images. The venv is built with Python 3.13 site-packages but the 3.14 runtime looks under python3.14/, so nothing is found. - Revert all three Dockerfiles to Python 3.13 runtime, matching builder - Drop Debian codename from runtime tags (python:3.13-slim instead of python:3.13-slim-bookworm) so latest Debian is used automatically - Disable Renovate dockerfile manager for python images to prevent independent runtime bumps that break builder/runtime compatibility - Add missing files to Renovate postUpgradeTasks: addon-dev Dockerfile, _build-and-release.yml, build-binary.yml, hotfix-release.yml, performance-tests.yml - Add sed command for runtime image tags (python:3.X-slim pattern)
Summary of ChangesHello @sergeykad, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses critical issues with Docker image builds by synchronizing Python versions between build and runtime stages, which were previously desynchronized by Renovate. It also enhances the robustness of the Renovate configuration to prevent future version mismatches and ensures consistent Python version updates across all relevant files and workflows. Highlights
Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively resolves a critical build failure by synchronizing the Python versions between the builder and runtime stages in the Dockerfiles. The accompanying changes to the Renovate configuration are excellent; they not only prevent this specific issue from recurring by disabling independent Python image updates but also make the Python version upgrade process more robust and maintainable through improved sed commands and a more comprehensive list of targeted files. The changes are well-documented and clearly address the root cause. I have one minor suggestion to further improve the future-proofing of the automation script.
kingpanther13
left a comment
There was a problem hiding this comment.
Review: Changes Requested
PR #626 has been merged, which reverted the runtime Python images to python:3.13-slim-bookworm in all three Dockerfiles. This PR now has merge conflicts since it modifies the same lines differently (using python:3.13-slim without the codename, plus the bookworm→trixie builder upgrade).
Action needed
Rebase on current master to resolve the three Dockerfile conflicts. After rebasing, the Dockerfile changes should reflect your intended state:
- Builder images:
trixie-slim(from this PR) - Runtime images:
python:3.13-slimwithout codename (from this PR, superseding #626'spython:3.13-slim-bookworm)
Renovate changes look good
The Renovate hardening is solid — I verified all five sed patterns by simulation against the new file formats, and confirmed the four newly-added workflow files (hotfix-release.yml, performance-tests.yml, _build-and-release.yml, build-binary.yml) all contain the Python version references that need updating. Disabling the dockerfile manager for Python images and coordinating through the asdf postUpgradeTasks is the right approach.
pr.yml workflow change
The bookworm-slim → trixie-slim change in pr.yml CI containers is correct and consistent with the Dockerfile builder upgrade.
Summary
The code and approach are good — just needs a rebase to resolve the conflicts from #626's merge.
…sion-sync # Conflicts: # CHANGELOG.md # homeassistant-addon/CHANGELOG.md # homeassistant-addon/config.yaml # pyproject.toml # src/ha_mcp/__init__.py
…ersion-sync # Conflicts: # CHANGELOG.md # Dockerfile # homeassistant-addon-dev/Dockerfile # homeassistant-addon/CHANGELOG.md # homeassistant-addon/Dockerfile
kingpanther13
left a comment
There was a problem hiding this comment.
Review: Approve
Thoroughly reviewed the diff across all 5 files. The fix is correct and the Renovate hardening is
effective.
Dockerfile changes (all 3) - Good
- Builder: bookworm-slim to trixie-slim with updated digest
- Runtime: python:3.13-slim-bookworm to python:3.13-slim with updated digest
- Python 3.13 consistent between builder and runtime - fixes the root cause
- All three Dockerfiles are in sync
.github/workflows/pr.yml - Good
- Container images updated to match the builder Debian change (trixie-slim)
renovate.json - Good (with one observation)
The `enabled: false` rule for `python` in `dockerfile` manager is the key fix - it directly
prevents Renovate from independently bumping the runtime Python image, which was the root cause
of the breakage. This rule is active and effective.
The postUpgradeTasks improvements (better sed patterns, coverage of
homeassistant-addon-dev/Dockerfile, additional workflow files, backreference patterns for Debian
codename flexibility) are solid improvements for future Python version bumps.
Observation (pre-existing, non-blocking): The `asdf` manager is not listed in
`enabledManagers` (which only includes `custom.regex` and `dockerfile`), so the
`postUpgradeTasks` section currently will not execute - Renovate will not scan
`.python-version` without the `asdf` manager enabled. This is a pre-existing gap, not
introduced by this PR. You may want to add `asdf` to `enabledManagers` in a follow-up to
activate the postUpgradeTasks.
Trade-off acknowledged: Disabling the `python` dockerfile manager also prevents automatic
digest-only updates (security patches) for the runtime image. This is a reasonable trade-off to
prevent version drift, but worth keeping in mind for periodic manual digest updates.
Overall: clean fix, well-structured, all CI green. Ship it.
EOF
)"
What does this PR do?
Fixes broken Docker images caused by Renovate PR #598 independently bumping the runtime Python image from 3.13 to 3.14 while the builder stage remained on 3.13. This caused
ModuleNotFoundError: No module named 'ha_mcp'in all three Docker images because the venv'ssite-packageslives underpython3.13/but the 3.14 runtime looks underpython3.14/.Changes:
Dockerfiles (all three):
python:3.13-sliminstead ofpython:3.13-slim-bookworm) so latest Debian is used automaticallyRenovate config:
dockerfilemanager forpythonimages to prevent independent runtime bumps that break builder/runtime compatibility\(-[a-z]\+-slim\)for builder image patterns so Debian codename upgrades don't require changing renovate.jsonpostUpgradeTasks:homeassistant-addon-dev/Dockerfile,_build-and-release.yml,build-binary.yml,hotfix-release.yml,performance-tests.ymlpython:3.X-slimpattern)pr.ymlto builder image sed (was missing, has uv container images)Verified by simulation: Ran all Renovate sed commands against the updated files simulating a 3.13→3.14 upgrade — zero remaining 3.13 references, all Debian codenames preserved.
Type of change
Testing
uv run pytest)uv run ruff check)All 11 Docker/add-on tests pass (previously
test_addon_startup_logsalways failed):Checklist