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

Add support for private repositories #27

Closed
jtpio opened this issue Jun 15, 2020 · 3 comments · Fixed by #42
Closed

Add support for private repositories #27

jtpio opened this issue Jun 15, 2020 · 3 comments · Fixed by #42

Comments

@jtpio
Copy link
Member

jtpio commented Jun 15, 2020

For now tljh-repo2docker can build environments from repositories that are publicly accessible.

However it would be useful if it could also build environments from private repositories.

BinderHub supports this use case with the git_credentials option.

The value is then passed as a GIT_CREDENTIAL_ENV environment variable to the builder (the jupyter/repo2docker:master Docker image): https://github.com/jupyterhub/binderhub/blob/3cb82fafa55d25e8fb6c6559423ffdef57919aa3/binderhub/build.py#L236

For tljh-repo2docker, we would need to pass these credentials using the GIT_CREDENTIAL_ENV environment variable to the command here:

cmd = [
"jupyter-repo2docker",
"--ref",
ref,
"--user-name",
"jovyan",
"--user-id",
"1100",
"--no-run",
"--image-name",
image_name,
"--appendix",
"\n".join(labels),
repo,
]

Something like the following:

cmd = [
    "GIT_CREDENTIAL_ENV=username=foo\npassword=bar",
    "jupyter-repo2docker",
    "--ref",
    ref,
    "--user-name",
    "jovyan",
    "--user-id",
    "1100",
    "--no-run",
    "--image-name",
    image_name,
    "--appendix",
    "\n".join(labels),
    repo,
]

The credentials could be specified in the form:

add-new

Or as a configurable for the tljh_repo2docker plugin.

@jtpio
Copy link
Member Author

jtpio commented Jun 15, 2020

Documentation to access private repositories for BinderHub:

https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-binderhub.html?accessing-private-repositories#accessing-private-repositories

The token can be generated from the GitLab UI:

image

@pierrepo
Copy link
Contributor

And I guess similar things could be done with the GitHub UI:

image

@SylvainCorlay
Copy link
Member

Optional extra git credentials could be in a <detail> section of the form.

There could be an option to fill the password with the hub authentication token for the case where we use the gitlab's SSO.

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 a pull request may close this issue.

3 participants