Skip to content

feat: additional mountpoints#5

Merged
johanneskoester merged 7 commits intomainfrom
feat/mountpoints
Feb 17, 2026
Merged

feat: additional mountpoints#5
johanneskoester merged 7 commits intomainfrom
feat/mountpoints

Conversation

@johanneskoester
Copy link
Contributor

@johanneskoester johanneskoester commented Feb 13, 2026

Summary by CodeRabbit

  • New Features

    • Configurable container mount points allowing users to add custom volume bindings and storage locations
    • Automatic mounting of the working directory and source cache into container executions
  • Improvements

    • Dynamic assembly of container mount configuration to include user-specified mounts
    • Safer command invocation with improved shell-escaping to reduce injection or parsing errors

@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a public mountpoints: List[str] setting (CLI-enabled) and imports List. Env.decorate_shellcmd now assembles container mount flags from the working dir, source-cache, and user-provided settings.mountpoints, replacing the previous hard-coded host/cache mount entries in the generated command.

Changes

Cohort / File(s) Summary
Container mountpoints
src/snakemake_software_deployment_plugin_container/__init__.py
Added mountpoints: List[str] to Settings with CLI metadata; imported List. Updated Env.decorate_shellcmd to build an assembled mountpoints string including existing hostdir and source-cache mounts plus user-specified mounts from settings.mountpoints, and to use that assembled string in the final container command (replacing prior hard-coded host/cache mount entries).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (1 file):

⚔️ src/snakemake_software_deployment_plugin_container/__init__.py (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: additional mountpoints' clearly and concisely describes the main change: adding support for user-configurable container mount points via a new mountpoints setting.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/mountpoints

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/snakemake_software_deployment_plugin_container/__init__.py`:
- Around line 49-55: The dataclass field "mountpoints: List[str] = field(...)"
uses a mutable default list (default=[]), which triggers dataclasses import-time
errors; change the field to use default_factory=list instead of default so
replace the default=[] with default_factory=list in the field() call for
mountpoints (preserving metadata like "nargs" and "help") to ensure safe
initialization of List[str] instances per dataclass instance.
- Around line 121-126: Replace the use of Python repr(!r) when building the
mountpoints string with shlex.quote to ensure POSIX shell-safe quoting for
getcwd(), SNAKEMAKE_MOUNTPOINT, self.source_cache and containercache (e.g., use
shlex.quote(getcwd()) and shlex.quote(SNAKEMAKE_MOUNTPOINT) instead of !r); for
the loop over self.settings.mountpoints, call shlex.quote on each mountpoint but
first validate the user-provided string contains a ':' separator (raise
ValueError with a clear message if missing) to avoid generating malformed -v
arguments; keep using the existing shlex import.

Comment on lines +121 to +126
mountpoints = (
f" -v {getcwd()!r}:{SNAKEMAKE_MOUNTPOINT!r}" # Mount host directory to container
f" -v {str(self.source_cache)!r}:{containercache!r}" # Mount host cache to container
)
for mountpoint in self.settings.mountpoints:
mountpoints += f" -v {mountpoint!r}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use shlex.quote() instead of !r for shell-safe quoting.

!r produces Python repr() output, not POSIX shell quoting. For paths containing both quote types (e.g., /home/it's "here"), repr can emit backslash-escaped single-quoted strings which are invalid in POSIX shell. Since shlex is already imported and used on line 136, use it consistently here as well.

Additionally, user-provided mountpoints on line 126 are interpolated without any format validation — a value missing the : separator will produce a confusing container-runtime error.

🔒 Proposed fix
         mountpoints = (
-            f" -v {getcwd()!r}:{SNAKEMAKE_MOUNTPOINT!r}"  # Mount host directory to container
-            f" -v {str(self.source_cache)!r}:{containercache!r}"  # Mount host cache to container
+            f" -v {shlex.quote(getcwd())}:{shlex.quote(SNAKEMAKE_MOUNTPOINT)}"  # Mount host directory to container
+            f" -v {shlex.quote(str(self.source_cache))}:{shlex.quote(containercache)}"  # Mount host cache to container
         )
         for mountpoint in self.settings.mountpoints:
-            mountpoints += f" -v {mountpoint!r}"
+            if ":" not in mountpoint:
+                raise WorkflowError(
+                    f"Invalid mountpoint format {mountpoint!r}, expected hostpath:containerpath"
+                )
+            mountpoints += f" -v {shlex.quote(mountpoint)}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountpoints = (
f" -v {getcwd()!r}:{SNAKEMAKE_MOUNTPOINT!r}" # Mount host directory to container
f" -v {str(self.source_cache)!r}:{containercache!r}" # Mount host cache to container
)
for mountpoint in self.settings.mountpoints:
mountpoints += f" -v {mountpoint!r}"
mountpoints = (
f" -v {shlex.quote(getcwd())}:{shlex.quote(SNAKEMAKE_MOUNTPOINT)}" # Mount host directory to container
f" -v {shlex.quote(str(self.source_cache))}:{shlex.quote(containercache)}" # Mount host cache to container
)
for mountpoint in self.settings.mountpoints:
if ":" not in mountpoint:
raise WorkflowError(
f"Invalid mountpoint format {mountpoint!r}, expected hostpath:containerpath"
)
mountpoints += f" -v {shlex.quote(mountpoint)}"
🤖 Prompt for AI Agents
In `@src/snakemake_software_deployment_plugin_container/__init__.py` around lines
121 - 126, Replace the use of Python repr(!r) when building the mountpoints
string with shlex.quote to ensure POSIX shell-safe quoting for getcwd(),
SNAKEMAKE_MOUNTPOINT, self.source_cache and containercache (e.g., use
shlex.quote(getcwd()) and shlex.quote(SNAKEMAKE_MOUNTPOINT) instead of !r); for
the loop over self.settings.mountpoints, call shlex.quote on each mountpoint but
first validate the user-provided string contains a ':' separator (raise
ValueError with a clear message if missing) to avoid generating malformed -v
arguments; keep using the existing shlex import.

@johanneskoester johanneskoester merged commit 29ba897 into main Feb 17, 2026
4 of 5 checks passed
@johanneskoester johanneskoester deleted the feat/mountpoints branch February 17, 2026 07:14
johanneskoester pushed a commit that referenced this pull request Feb 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.2.0](v0.1.0...v0.2.0)
(2026-02-17)


### Features

* additional mountpoints
([#5](#5))
([29ba897](29ba897))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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