Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split ParseBindpath from config get/setters and add --mount, from sylabs 319 & 324 #6283

Merged
merged 9 commits into from
Nov 27, 2021

Conversation

DrDaveD
Copy link
Collaborator

@DrDaveD DrDaveD commented Nov 9, 2021

This pulls in sylabs prs

Did not include the sylab's PR's addition of a StringArray flag, and instead used the cmdline.StringArray type added in #6008.

The original pr descriptions were:

The parsing routines for bind mount specifications are buried among a large amount of simple Getter/Setter code for the main config struct within pkg/runtime/engine/singularity/config. There are also no unit tests on the parsing, and it's a little under-described.

In advance of #118 work, split the parsing functions into a separate file for clarity, and add basic testing. Add a couple of comments, and constants to make things a bit clearer. No real logic changes here - code was just moved.

Add a --mount flag, and corresponding environment variable that can be used to specify bind mounts in type=bind,source=<src>,destination=<dst>[,options...] format. This improves CLI compatibility with other runtimes, and allows binding paths containing : and , characters (using CSV style escaping like docker).

A general goal is to achieve as much compatibility as possible with https://docs.docker.com/storage/bind-mounts/#choose-the--v-or---mount-flag

* Only `type=bind` is supported, and inferred if not specified.

* Multiple binds can be specified with multiple `--mount` flags, or `\n` delimited strings in the `SINGULARITY_MOUNT` env var.

* `source/src`, `destination/dst/target`, `ro/readonly` are synonyms

* The singularity specific `image-src=<path>` and `id=<int>` options for bind mounting out of an image file are supported by `--mount`, as they are for `--bind/-B`.

* `--mount` support has been added for action commands and build.

Implementation is via parsing of --mount spec strings into a BindPath struct. This parsing is tested in unit tests. Since the functionality of different BindPath configurations is already verified in e2e tests with --bind flags, e2e testing of --mount is restricted to limited additional cases covering single and double --mount

Note also that CLI flag handling was extended to allow StringArray flags, where values are not split into a slice on ','. This was a requirement for the --mount spec syntax.

@DrDaveD DrDaveD requested a review from cclerget November 9, 2021 19:51
@DrDaveD DrDaveD merged commit 09dd555 into apptainer:master Nov 27, 2021
@DrDaveD DrDaveD deleted the split-parsebindpath-add-mount branch November 27, 2021 14:40
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.

3 participants