Skip to content

fix(image): honor --pip in the on-instance Dockerfile-build path (calque#196) - #197

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/calque-196-pip-in-docker-build
Aug 16, 2026
Merged

fix(image): honor --pip in the on-instance Dockerfile-build path (calque#196)#197
scttfrdmn merged 1 commit into
mainfrom
fix/calque-196-pip-in-docker-build

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

  • Found via a real calque real --script blending_app.py --function inspect_netcdf_bundle --pip xarray --pip netCDF4 run against real AWS: the Dockerfile built successfully, then the container run failed immediately with No module named 'xarray'.
  • Root cause: --pip was consumed ONLY by bootstrap.go's HostMode branch. A picked unit whose resolved image needs an on-instance Dockerfile build (calque#177's NeedsBuild path — e.g. a real dependency installed via a git-cloned requirements.txt, which calque correctly can't statically resolve into a .pip_install(...) layer) silently dropped --pip entirely, with no leak, no warning.
  • New image.Spec.PipPackages renders an extra RUN pip3 install --no-cache-dir <packages> layer, placed after the resolved chain's own steps (so it can supplement/override anything the chain's own pip_install already laid down) and before the worker-glue COPY lines. Threaded through realrun.go's NeedsBuild call site.
  • The separate bare-pull path (calque#176, no Dockerfile built at all) now leaks loudly when --pip is supplied there too, since there's genuinely no Dockerfile layer to add it to in that case — better than the prior silent drop.

Files touched

  • internal/image/dockerfile.goSpec.PipPackages, extra layer rendering.
  • internal/image/dockerfile_test.go — new tests (extra-layer placement, byte-for-byte-unchanged empty case).
  • cmd/calque/realrun.go — threads o.pipPackages through the NeedsBuild call site; new leak on the bare-pull path.
  • CHANGELOG.md.

Test plan

  • go build ./... && go vet ./... && gofmt -l . && go test -count=1 ./... — all pass
  • golangci-lint run ./... — 0 issues
  • ruff check . — all checks passed
  • New TestRenderPipPackagesAddsExtraLayer/TestRenderNoPipPackagesUnchanged, using a fixture (runCommandsOnlyImage) mirroring blending_app.py's real image-chain shape that triggered this live

…que#196)

Found via a real calque real --script blending_app.py --pip xarray run:
the Dockerfile built successfully, then the run failed with "No module
named 'xarray'" -- --pip was consumed ONLY by bootstrap.go's HostMode
branch, silently dropped once a picked unit's resolved image needed an
on-instance build instead (a real dependency installed via a git-cloned
requirements.txt calque can't statically resolve into a
.pip_install(...) layer).

New image.Spec.PipPackages renders an extra RUN pip3 install layer after
the resolved chain's own steps and before the worker-glue COPY lines --
threaded through realrun.go's NeedsBuild call site. The separate bare-pull
path (calque#176, no Dockerfile at all) now leaks loudly instead of
silently dropping --pip there too, since there's genuinely no layer to
add it to in that case.
@scttfrdmn
scttfrdmn merged commit 9cc723b into main Aug 16, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/calque-196-pip-in-docker-build branch August 16, 2026 06:22
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.

1 participant