Repository navigation
docs: add a derived-image recipe for plugins - #355
Conversation
Install plugins in local builds of the image from the package index, with their dependencies (`--build-arg PLUGINS="<requirements>"`), then run `pip check`. Empty by default, so the published images are unchanged; Docker Compose passes the host's `PLUGINS`. Not pinned by hash: deployments use the derived-image recipe instead. Refs #323 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the Dockerfile of the derived-image recipe for plugins (`examples/plugin-image/`): it installs the hash-pinned wheels of its build context only (`--no-index --no-deps --require-hashes`), then runs `pip check`; its `Dockerfile.dockerignore` sends `plugins.txt` and `wheels/` only. The smoke test (`tests/smoke/plugins.sh`, a CI step of `smoke`) builds it from the app's image with a test plugin (`tests/smoke/plugin/`), restarts the app with the plugin enabled and checks that new tasks get the plugin's tag. Refs #323 Co-Authored-By: Claude Opus 5.5 <[email protected]>
New page "Plugin images": choose the release image by digest, resolve the plugins against it (pip's dry-run report, with hashes), download and verify the wheels, build with `examples/plugin-image/`, scan and sign, deploy with the chart's values, and local builds with `PLUGINS`. The plugins page and the chart's README link it; the chart's example sets the derived image together with the plugins. The docs and the smoke test's config overlay are validated with the other plugin examples, and Development describes the smoke test. Closes #323 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review findings: resolve `plugins.in` with the image's packages as constraints, so that plugins needing other versions of them fail at once instead of silently changing them; note empty `plugins.txt`, that `PLUGINS` takes specifiers without spaces and never credentials, and the chart's image value in the plugins page and `values.yaml`. The smoke test also checks that a wrong hash fails the build. Refs #323 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the resolve step of the recipe into `examples/plugin-image/ resolve.sh`, which writes `plugins.txt` only if pip resolved the plugins (a failed resolution left an empty file before, which the docs read as "nothing to build"). The smoke test pins the test plugin with it, from the wheel's directory, compares the pin with the wheel's hash, and requires the wrong-hash build to fail with pip's hash error. The example Dockerfile skips the build check of its base image argument, which has no default on purpose. Refs #323 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThis PR adds a documented, reproducible derived-image recipe that resolves plugins against a pinned proTES release, verifies and hash-pins wheel artifacts, builds offline with dependency checks, and integrates deployment guidance, local-development support, and comprehensive CI smoke coverage. Sequence diagram for plugin image resolution and buildsequenceDiagram
participant Operator
participant Resolve as resolve.sh
participant Image as proTES release image
participant Docker as Docker build
participant Pip as pip
Operator->>Resolve: resolve.sh PROTES_IMAGE plugins.in plugins.txt
Resolve->>Image: pip list --format freeze
Image-->>Resolve: Installed package constraints
Resolve->>Image: pip install --dry-run --report --constraint
Image-->>Resolve: Resolved distributions and wheel hashes
Resolve-->>Operator: Write plugins.txt
Operator->>Docker: Build with PROTES_IMAGE, plugins.txt, wheels/
Docker->>Pip: pip install --no-index --no-deps --require-hashes
Pip-->>Docker: Install pinned local wheels
Docker->>Pip: pip check
Pip-->>Docker: Dependency validation
Flow diagram for the reproducible plugin image recipeflowchart LR
A["Pinned proTES release image"] --> B["resolve.sh\nResolve plugins with image constraints"]
B --> C["plugins.txt\nVersions and wheel hashes"]
C --> D["pip download\nDownload hash-verified wheels"]
D --> E["gh attestation verify\nVerify wheel provenance"]
E --> F["Derived Docker image\nOffline install and pip check"]
F --> G["Scan and sign image"]
G --> H["Deploy with Helm\nprotes.image and plugins"]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Documentation build overview
4 files changed+ plugin-images/index.html± deployment/index.html± development/index.html± plugins/index.html |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #355 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 2209 2209
=========================================
Hits 2209 2209 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="examples/plugin-image/resolve.sh" line_range="28" />
<code_context>
+ < "${requirements}")"
+pins="$(jq -r '.install[] | "\(.metadata.name)==\(.metadata.version) --hash=sha256:\(.download_info.archive_info.hashes.sha256)"' \
+ <<< "${report}")"
+printf '%s\n' "${pins}" | sed '/^$/d' > "${output}"
</code_context>
<issue_to_address>
**Old plugin pins survive failed resolution**
When a previous resolution wrote the output and a later resolution fails, `resolve.sh` exits before writing `output`, leaving the earlier `plugins.txt` in place, so callers that continue build with the old plugin set instead of the requested one.
Remove or truncate `output` before starting resolution so a failed run cannot leave stale pins.
</issue_to_address>
### Comment 2
<location path="tests/smoke/plugins.sh" line_range="22" />
<code_context>
+context="$(mktemp -d)"
+trap 'rm -rf "${context}"' EXIT
+
+base="${PROTES_IMAGE:-protes:local}"
+# The build context of the recipe: the wheel, and `plugins.txt`, which
+# `resolve.sh` pins against the base image, from the wheel's directory
</code_context>
<issue_to_address>
**Concurrent rebuild changes plugin base**
When another Compose build retags `protes:local` after resolution but before the derived-image build, the resolver reads the image currently tagged `protes:local`, but the later `docker build` resolves that tag again; a concurrent Compose rebuild can retag it between those steps, so the derived image is built on a different package set than the one used to pin the plugin, making the smoke result flaky or invalid.
Resolve and build from the same immutable image ID or digest, capturing it before resolution and using it for both operations.
Also at `tests/smoke/plugins.sh:41`.
</issue_to_address>
### Comment 3
<location path="docs/plugin-images.md" line_range="48" />
<code_context>
+or a release train, e.g.:
+
+```text
+foca-plugin-tes-routing-distance==<version>
+```
+
</code_context>
<issue_to_address>
**Name a real plugin release**
The issue calls for a real foca-plugins release train, but the recipe's example uses a version placeholder and the page says no foca-plugins distributions are published yet. The general recipe and CI test work, but the documented foca-plugins example is not yet directly usable with a real release.
</issue_to_address>Linked issues
#323 docs: add a derived-image recipe for plugins · 5 of 6 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Provide a derived-image recipe for hash-pinned plugins, including verification, scanning, and signing. | ✅ Met | The new Plugin images page documents the full workflow. It resolves pins with pip's dry-run report rather than pip-compile/uv and uses gh attestation verify for artifact attestations. |
| 2 | Add an empty-by-default PLUGINS build argument as a convenience for local builds, documented as not hash-pinned. |
✅ Met | The root Dockerfile installs the argument and runs pip check; Docker Compose passes the host value through, and the docs distinguish this from the deployment recipe. |
| 3 | Show the derived image together with plugin configuration in the chart README, without adding chart install logic. | ✅ Met | The deployment README example sets protes.image and the plugin allowlist together; no plugin installation logic is added to the chart. |
| 4 | Do not publish an image variant containing all plugins. | ✅ Met | The new page says published proTES images contain only built-in plugins and explains why there is no all-plugins image. |
| 5 | Build a derived image with a test plugin and verify proTES loads it through the allowlist. | ✅ Met | The CI smoke step builds an image with the test distribution, enables the plugin, and checks that a new task receives its tag. |
| 6 | Name a real foca-plugins release train in the recipe. | 🟡 Partly met | The page describes the planned foca-plugins distributions and trains, but says none are published yet and uses <version> rather than naming a real release. |
Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: examples/plugin-image/resolve.sh:28, tests/smoke/plugins.sh:22, docs/plugin-images.md:48
resolve.sh removes the output file before resolving, so that a failed run cannot leave the pins of an earlier one for the build (Sourcery). Refs #323 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Adds the derived-image recipe for plugins (sub-issue of #194):
docs/plugin-images.md, nav after "Plugins"). It covers the following steps:examples/plugin-image/resolve.sh. The script runs pip inside the image, with the image's packages as constraints, and writesplugins.txtwith versions and wheel hashes.gh attestation verify, link to the verification docs of foca-plugins).examples/plugin-image/Dockerfile. It installs only the hash-pinned wheels of the build context (--no-index --no-deps --require-hashes), then runspip check. ItsDockerfile.dockerignoresends onlyplugins.txtandwheels/, so.env*never reach the build.protes.imagetogether withplugins).PLUGINSbuild argument in the rootDockerfilefor local builds only. It is empty by default, so published images only gain a no-op step. It is not hash-pinned,pip checkruns after the install, and Docker Compose passes the host'sPLUGINSthrough.docs/plugins.mdlinks to the recipe too, and its foca-plugins link now points to the foca-plugins docs site instead of GitHub.smokejob gets a new step, "Check plugin image" (tests/smoke/plugins.sh). It runs these checks with a test plugin distribution (tests/smoke/plugin/, pluginsmoke.tag, which tags new tasks):resolve.shfrom a local directory. The pin must match the wheel's hash.protes:local.tests/smoke/plugins.yaml,tests/smoke/plugins.config.yaml).tests/test_config_examples.pynow also validates the plugin examples of the new page and of the new smoke overlay.proTES stays on FOCA 0.18, so no FOCA 0.19 features (plugin store) are documented. The page says that foca-plugins has not published any plugins yet.
Closes #323
Verification
pre-commit run --all-filespassed.mkdocs build --strictpassed. The Dockerfile snippet and{{ version }}render.coverage run -m pytest(mongomock) passed: 1042 passed, 169 skipped (Helm is not installed locally, so the chart tests were skipped), 100% coverage.Local Docker, on an isolated Compose project with its own image names and port:
tests/smoke/check.shpassed.tests/smoke/plugins.shpassed.Plugin 'smoke.tag' is not installed).The operator commands of the page, run against a locally built proTES image with real PyPI packages (
humanize,requests-toolbelt):pydantic<2) fails without writingplugins.txt.pip checkwork, the image runs as user 1000, and a wrong hash fails the build.PLUGINSbuild argument: verified by hand by building with and without it.The chart README example validates against
values.schema.json(checked with jsonschema).CI on the PR: all checks passed, including the "Check plugin image" step of the smoke test ("Plugin smoke test passed") and the Read the Docs preview.
Review
Not light lane: the PR changes the
Dockerfile, CI and test scripts, so it got the full review in two rounds. All medium findings were fixed: resolving against the image's packages as constraints, failed resolution no longer leaving an emptyplugins.txt, the resolve step tested in CI, the link to the chart README's Configuration section, and a negative hash test. The cheap low findings were fixed too.Declined review findings
docs/plugins.md: requested by the maintainer's brief, to keep edits to shared files minimal.docs/plugins.mdlinks the page.pip-compile/uv andpypi-attestations verifyas named in the issue: the recipe resolves with pip's dry-run report inside the image instead, so the result fits the image's Python, platform and installed packages without extra tools. The page says why. I could not verify the exactpypi-attestationsCLI syntax here, so the page showsgh attestation verify(as foca-plugins documents it) and links foca-plugins' verification docs for PEP 740.check.shandplugins.sh: left as is. The duplication is a few lines, and leavingcheck.shuntouched avoids conflicts with the parallel provenance work.PLUGINSbuild argument: it installs from the package index, so it was verified by hand only. The page documents its limits: specifiers without spaces, no credentials.setuptools>=83in the test plugin: kept, as in foca-plugins (CVE fix).plugins.sh: kept. The image names andPYTHONlet the script run next to other local stacks.Open questions
None.
🤖 Generated with Claude Code