-
Notifications
You must be signed in to change notification settings - Fork 16
Design (+implementation) to switch to support/use OCI containers to produce singularity images #153
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
Open
yarikoptic
wants to merge
2
commits into
master
Choose a base branch
from
use-oci
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| Plan to refactor codebase on how we approach creation of singularity/apptainer containers. | ||
|
|
||
| We want to not create them directly from docker images, but rather first rely | ||
| on functionality in https://github.com/datalad/datalad-container/pull/277 | ||
| (skopeo branch of the https://github.com/yarikoptic/datalad-container/ fork) to | ||
| initiate OCI container locally using `datalad containers-add oci:docker://...` | ||
| under `images-oci/` subdataset, under similar path (e.g. | ||
| repronim/repronim-reproin--0.13.1.oci for | ||
yarikoptic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| images/repronim/repronim-reproin--0.13.1.sing in this one), registering it to | ||
| be ran with `{img_dspath}/scripts/oci_cmd run` which we are to provide as well. | ||
| E.g. | ||
| datalad containers-add --url oci:docker://bids/aa:v0.2.0 -i bids/bids-aa--0.2.0.oci bids-aa | ||
|
|
||
| under images-oci// subdataset. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remember that we might use |
||
|
|
||
| While generating such OCI image we need to ensure that either all produced | ||
| files are under annex with URL or directly in git (if text files), e.g. | ||
|
|
||
| git annex find --not --in datalad --and --not --in web bids/bids-aa--0.2.0.oci | ||
|
|
||
| (could be under web directly or via datalad downloader!) | ||
|
|
||
| `scripts/oci_cmd` could be simple for now: | ||
|
|
||
| #!/bin/bash | ||
|
|
||
| apptainer "$@" | ||
|
|
||
| Then, after generation of OCI image, we would need to produce singularity SIF file using | ||
| (assuming that {image} would be the replacement with portion of path to image file like repronim/repronim-reproin--0.13.1) | ||
|
|
||
| datalad run -m "Build SIF image for {image}.sif" --output images/{image}.sif scripts/oci_cmd build images/{image}.sif images-oci/{image}.oci/ | ||
|
|
||
|
|
||
| After all that done and works, we would need to have a migration | ||
| functionality which would produce .sif to replace all images for which we had Singularity* files but without custom commands, rather just basic wrappers. Full list could be obtained using | ||
|
|
||
| git grep -l 'Automagically prepared' images | ||
|
|
||
| and files would look like | ||
|
|
||
| ❯ head images/bids/Singularity.bids-aa--0.2.0 | ||
| # | ||
| # Automagically prepared for ReproNim/containers distribution. | ||
| # See http://github.com/ReproNim/containers for more info | ||
| # | ||
| Bootstrap: docker | ||
| From: bids/aa:v0.2.0 | ||
|
|
||
| so the goal would be to produce OCI image taking that "From:" as pointing to docker hub, in the above example (ran under images-oci/ subdataset). So the command to "containers-add" would be similar to above example: | ||
|
|
||
| datalad containers-add --url oci:docker://bids/aa:v0.2.0 -i bids/bids-aa--0.2.0.oci bids-aa | ||
|
|
||
| and then verifying that all annex files are available from URLs: | ||
|
|
||
| git annex find --not --in datalad --and --not --in web bids/bids-aa--0.2.0.oci | ||
|
|
||
| should come out empty. (so we need a generic helper function to be used here to reuse) | ||
yarikoptic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Original images, and corresponding recipes, like in this case | ||
| images/bids/Singularity.bids-aa--0.2.0 where "From:" was found, and the corresponding image images/bids/bids-aa--0.2.0.sing should be "git rm"ed and committed with informative message. Path to the image within .datalad.config should be replaced to point to .sif instead of original .sing version. | ||
yarikoptic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| While developing, try migration first on some simpler cases like | ||
|
|
||
| images/bids/bids-validator--1.2.3.sing | ||
| images/bids/bids-rshrf--1.0.0.sing | ||
|
|
||
| For migration, add an option to skip failing, and we would need some log file listing those which failed to convert. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bpinsard here is my "plan"... WDYT?