fix: add curl when containerize with wrapper#4115
fix: add curl when containerize with wrapper#4115johanneskoester merged 2 commits intosnakemake:mainfrom
Conversation
Fix snakemake#4114 `--containerize apptainer` option from snakemake#4030, is used to create apptainer definition file from workflow. When the workflow has rule with `wrapper` the image doesn't build, it's missing `curl`. Add check for a wrapper rule in workflow and add `curl`. Add image size optimization if wrapper rule in workflow. Add test for containerize with wrapper.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds conditional installation of curl and a guarded apt-list cleanup into the Apptainer containerization output when remote environment files are fetched; also adds a test validating generated apptainer.def contains the curl installation and environment source reference. Changes
Sequence Diagram(s)sequenceDiagram
participant Snakemake
participant Containerizer
participant BaseImage
participant RemoteRepo
Snakemake->>Containerizer: request containerize (apptainer) for rule with wrapper env
Containerizer->>BaseImage: emit %post commands
alt needs_curl == true
Containerizer->>BaseImage: add "apt-get update" / "apt-get install -y curl"
BaseImage->>RemoteRepo: curl -L fetch environment.yaml
RemoteRepo-->>BaseImage: environment.yaml
Containerizer->>BaseImage: add "rm -rf /var/lib/apt/lists/*"
else
BaseImage->>RemoteRepo: (no remote fetch)
end
Containerizer-->>Snakemake: write apptainer.def
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip You can disable the changed files summary in the walkthrough.Disable the |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/snakemake/deployment/containerize.py`:
- Around line 238-240: The guard using has_wrapper_rule (computed from
workflow.rules) is incorrect; change the condition so curl is installed only
when building an Apptainer image or when any remote environment file requires
curl (e.g. replace has_wrapper_rule with a boolean like needs_curl =
is_apptainer_build() or any(env.is_remote for env in workflow.environments)),
then call formatter.run_command("apt-get update") and
formatter.run_command("apt-get install -y --no-install-recommends curl") only
when needs_curl is true; update the two places referencing has_wrapper_rule to
use this new needs_curl check so Docker builds won’t get apt commands and
Apptainer/remote-env cases are covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5de541ed-8f41-424c-86a7-2bc696ef86c1
📒 Files selected for processing (2)
src/snakemake/deployment/containerize.pytests/tests_using_conda.py
🤖 I have created a release *beep* *boop* --- ## [9.17.3](v9.17.2...v9.17.3) (2026-03-24) ### Bug Fixes * add curl when containerize with wrapper ([#4115](#4115)) ([44979e4](44979e4)) * ensure proper wrapper prefix is passed to CWL and shown in wrapper error messages ([#4121](#4121)) ([11b6f29](11b6f29)) * ensure that strings that purely contain integers or floats (e.g. "42") remain strings when parsing profiles ([#4119](#4119)) ([3ca08e1](3ca08e1)) * incorrect highlighting in HTML report ([#4120](#4120)) ([1ef224d](1ef224d)) ### Documentation * document an accidental (sorry) recent breaking change in type checking compatibility of Python scripts, in favor of a clean and robust new syntax ([#4116](#4116)) ([013bc43](013bc43)) * Rework tutorial ([#4068](#4068)) ([4bba4a9](4bba4a9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Released version 9.17.3 <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Fixes #4114
--containerize apptaineroption from #4030, is used to create apptainer definition file from workflow. When the workflow has rule withwrapper:the image doesn't build, it's missingcurl.Add check for a wrapper rule in workflow and add
curl. Add image size optimization if wrapper rule in workflow. Add test for containerize with wrapper.QC
docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).AI-assistance disclosure
I used AI assistance for:
Summary by CodeRabbit
New Features
Tests