DeiC-HPC / cotainr

cotainr - a user space Apptainer/Singularity container builder.
European Union Public License 1.2
18 stars 5 forks source link

Improve documentation: private github repositories and ssh-agent forwarding #53

Closed cscjlan closed 5 months ago

cscjlan commented 5 months ago

It seems as though it's possible to use private github repositories with pip in the conda environment file only if one uses ssh-agent forwarding. This is because apptainer can use keys from the host ssh-agent but not from the host filesystem.

It would be useful to mention this in the documentation, even though it's not related to cotainr per se, but rather to apptainer.

An example conda environment file, where the foo/bar.git is a private repository. This only works, if the host machine uses ssh-agent forwarding.

name:
  - test_cotainr
channels:
  - conda-forge
dependencies:
  - python=3.11
  - git
  - openssh
  - pip
  - pip:
    - "--editable=git+ssh://git@github.com/foo/bar.git@SOMEHASHCODE#egg=baz"

This was tested on LUMI with cotainr/2023.01.0-cray-python-3.9.12.1

Chroxvi commented 5 months ago

@cscjlan Thanks for the feedback!

I would like to add more details to the cotainr documentation about the options and limitations when installing pip dependencies in a conda environment using cotainr. Basically, anything that is possible to install from a pip requirements.txt file on the host file system should also be possible to install in a container using cotainr. Since most of what can be achieved when installing conda/pip environments using cotainr is limited by what can be achieved by conda and pip, I would like not to go too much into detail in the cotainr documentation and only cover the basics and then the details that are specific to Singularity/Apptainer and/or cotainr. This ssh agent forwarding problem, your are describing, is a good candidate for inclusion.

You are more than welcome to create a PR yourself to add this to the cotainr documentation. Otherwise, I will try to collect a few more use cases and then update the documentation at some point. Also if you have more examples of such use cases of cotainr, where you need a few tweaks/workarounds to make them work, I would love to hear more about them.

cscjlan commented 5 months ago

I just started using cotainr on friday so I don't have any more particular tips or tricks, but if I encounter any, I'll let you know!

I'll create a PR to update the documentation.

Edit: Here's the PR.

eskech commented 5 months ago

Thanks for taking the time to do this. We will look at the PR.

eskech commented 5 months ago

We have merged the PR and will close the issue.