jupyterhub / nbgitpuller

Jupyter server extension to sync a git repository one-way to a local path
https://nbgitpuller.readthedocs.io
BSD 3-Clause "New" or "Revised" License
205 stars 84 forks source link

Support for named server instances #307

Closed Snozzberries closed 11 months ago

Snozzberries commented 1 year ago

Proposed change

When urlPath specifies a named server instance, the git clone process targets that instance.

Alternative options

An additional server instance could be supplied as a URL parameter.

Who would use this feature?

JupyterHub users deploying named server instances.

(Optional): Suggest a solution

I couldn't see where any of the classes identify the server instance from a spawner or the hub. Unsure if there is a starting point for implementing, but my Python isn't great.

welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

yuvipanda commented 1 year ago

Thanks for opening this issue!

nbgitpuller is a jupyter server extension, rather than a jupyterhub extension. As such, it doesn't really know anything about named servers - the servers themselves must be already started for nbgitpuller to run. Not sure how we would go about this.

Snozzberries commented 1 year ago

That makes sense, it was also why I was surprised it didn't just work.

As an example, if I pre-launch a named server called "test" and prepend that to a custom URL path. nbgitpuller UI is shown with no errors then processes the redirection properly, but no content is downloaded. Where if I leave that off and just use the user's instance it works fine.

Unsure even where that communication would breakdown. I imagine the hub proxy is sending the query parameters to the instance and defaults to the user instance since it doesn't know about the query parameters.

To add more context too, and increase the confusion on where the communication is happening.

My user has a individual user server spanwed and a named server spawned.

The nbgitpuller URL will download the content to the individual's user server but still redirect to the named server.

Snozzberries commented 1 year ago

After some more testing, this actually can work as exists too.

https://**jupyterHubServerUrl**/hub/user-redirect/**namedServerName**/git-pull?repo=**repoUrl**&urlPath=lab%2Ftree%2F**repoName**%2F**filenameToLaunch**&branch=**branch**

The namedServerName just needs to be added to the hub URL not the URL Path parameter.

Unsure if this is how the browser plugin for nbgitpuller works today, but could likely be added as an optional field to the link generator form.