Repository navigation
Fix builder plugin import error: declare Docker SDK in requirements.txt - #3428
Open
CloudCorpRecords wants to merge 1 commit into
Open
CloudCorpRecords wants to merge 1 commit into
CloudCorpRecords wants to merge 1 commit into
Conversation
The builder plugin imports the Python Docker SDK at module load (`import docker` in plugins/builder/app/build_svc.py) and pins `docker~=6.1.0` in plugins/builder/requirements.txt, but the core runtime never installed it: the Dockerfile runtime stage installs only requirements.txt, which did not declare it. CALDERA therefore logged "Error importing plugin=builder, No module named 'docker'" and the plugin failed to load. Declare the SDK in requirements.txt, pinned exactly as the plugin itself declares it (`docker~=6.1.0`). The Dockerfile runtime stage already installs requirements.txt, so the image gains the module with no Dockerfile change, and non-Docker installs are fixed too. Fixes apache#3424 Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #3424: starting CALDERA (e.g. from the Docker image) logs
ERROR Error importing plugin=builder, No module named 'docker'and thebuilder plugin fails to load.
Root cause: the builder plugin imports the Python Docker SDK at module
load (
import dockerinplugins/builder/app/build_svc.py) and pinsdocker~=6.1.0inplugins/builder/requirements.txt, but the coreruntime environment never installs it. The Dockerfile runtime stage
installs only
requirements.txt, which did not declare the SDK.Fix: declare the SDK in
requirements.txt, pinned exactly as theplugin itself declares it (
docker~=6.1.0). The Dockerfile runtimestage already installs
requirements.txt, so the image gains themodule with no Dockerfile change, and non-Docker installs (the
CONTRIBUTING.md setup path) are fixed too.
A regression test (
tests/test_builder_plugin_dependency.py) assertsthe SDK is declared in
requirements.txtand importable in anenvironment built from it; both assertions fail without this change.
Type of change
How Has This Been Tested?
Reproduced first in a clean venv built exactly like the runtime
(
pip install -r requirements.txt, Python 3.12):python -c "import docker"->ModuleNotFoundError: No module named 'docker'python -c "import plugins.builder.app.build_svc"-> same error atplugins/builder/app/build_svc.py, line 6 (import docker)After the change, in a venv rebuilt from the updated
requirements.txt:import dockersucceeds (docker 6.1.3);plugins.builder.app.build_svcimports cleanly.
2 failed. After fix:2 passed.pytest --asyncio-mode=auto tests/test_builder_plugin_dependency.py tests/api/v2/handlers/test_plugins_api.py tests/services/test_app_svc.py->
13 passed(the 11 pre-existing tests in the two relevant suitesalso pass on unmodified master).
machine shows failures identical to unmodified master (pre-existing
environment issues, proven by re-running the same chunks on a
pristine checkout): tests/contacts 1 failed, tests/obfuscators
2 errors, tests/services 1 failed / 111 passed, tests/web_server
8 errors, tests/api does not finish within 240s — all unchanged
with and without this patch.
pip-audit -r requirements.txt(the tox safety gate): no findingsfor
docker; the 15 findings reported are all in pre-existing pins.flake8 tests/test_builder_plugin_dependency.pyclean.Checklist: