-
-
Notifications
You must be signed in to change notification settings - Fork 28
Add/remote registry #576
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/remote registry #576
Conversation
this still needs tests written - I think I will need to make an external remote registry with some arbitrary change to test, OR just test the interaction with the remote provider and handle the updates via local test files Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
I am wondering if the upgrade function should be done between two registries, where the registry being upgraded is required to be a filesystem? Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
@muffato @marcodelapierre @surak I pulled it off! |
Hi @vsoch . That looks very impressive 👏🏼 ! I've started looking at the code, but I haven't run any tests yet. I'll try to get to it this week if that's OK ? |
Definitely OK by me! |
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.
Looks very good to me. sync-registry
is a great addition, and I think it can simplify our workflow tremendously. But most importantly, the repository feels so clean with the container.yaml out of the way 😌 !
I've tested a few things (installing and adding a container) and left some comments.
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
@muffato I've done various tweaks (and ran isort/black) a55c243. For next steps:
|
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
okay - and got started on creating a GitLab equivalent! https://gitlab.com/singularityhub/shpc-registry supposedly pages take 30 minutes to deploy... so not sure if I did it right yet! I also realized default branches there are "master" so I added a branch arg to the docgen command here. |
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
okay Gitlab registry (and remote here) is added, and I un-broke the CI! 😆 |
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
@muffato I've finished 2/3 things we discussed above - creating a GitLab remote (and support for it) and configuring sync from file. The last bullet I'll need some pointers from you for how to reproduce the bugs you saw (and to be sure we test for them!) |
Okay - I opted for https://docs.python.org/3/library/shutil.html#shutil.copy2 because that also preserves metadata (in addition to data and permissions). |
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.
Hi. FYI I'm looking at the code that does the copying, to make it exclude .git
. I found where the bug is, and I'll submit a PR onto this PR later today
I'm not sure where I'm going with my changes, so best is that I describe what I've noticed.
|
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
…larity-hpc into add/remote-registry
@muffato give that a shot! I'm going for a run, then probably a break/dinner, I promise I'll be back later tonight after that! 🥑 |
8739676 made the trick, fantastic ! 💯 I can't find how to do it anymore, but #576 (comment) and #576 (comment) can be marked as resolved 🚀 I think the only things I want to test today are:
|
Sounds good! |
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.
Hi
The yaml file works great (with that little addition) ! And I've also tested the check for unknown arguments on the command-line: a life saver !
About GitLab:
shpc show
breaks if the repo is under groups because shpc doesorg, repo = self.source.split("/")[3:]
, while gitlab allows groups in between the org and repo name, e.g.https://gitlab.internal.sanger.ac.uk/tol-it/software/shpc-installation.git
- Once moved to match
org, repo
, then it fails because I don't have anything underhttps://$org.gitlab.io/$repo/library.json
, and it's due to two things:- I haven't set up
.gitlab-ci.yml
(I guess that's what's needed to generatelibrary.json
?) - Even if had it, our "pages" are at
https://$org.pages.internal.sanger.ac.uk/$repo_name
(I don't know how it looks like with groups !)
- I haven't set up
- At least
shpc sync-registry
works, even with our internal one
Questions:
- How important is this
library.json
API ? In case it can't be found, what about taking a temporary local checkout and building a cache from there ? - Then, what about ssh support ? If a substitute for
library.json
can be found, I guess we don't require https any more, and ssh would be just fine (since all git access would be done viagit clone
) - How / where to define the tag/branch and the subdir ? I can see the code supports that, but only the tag option in
sync-registry
- Do you really want to support on-prem installations of gitlab ? and do they all follow this pattern ?
@muffato try using my dummy as an example: https://gitlab.com/singularityhub/shpc-registry. That should have the workflow to generate and deploy to pages - I'm kind of a GitLab noob but after that I was able to click pages and make sure my artifact in "public" worked. For the other stuffs I'll take a closer look and make some tweaks tonight, and in the meantime if you want to share the update to match "org" and "repo" I can be sure to have it handy later! We should probably have a fallback for show that checks for the library and then issues an error if it doesn't exist, and tells the user to visit the repository if they want to browse. More specifically:
I think this is important for quick query - e.g.,
We could definitely look into this! My thinking is we should work on this after this PR (which is already very big). If you want to open an issue with some details about how this works / what you want to work we can have it handy for when that time comes.
Currently it's just via the command line, so you can provide it with or without a file. I think we might honor the branch but I don't recall if we pass forward a subdirectory preference, the reason being we assume a remote registry is going to honor a convention of always having recipes at the root (do you see a use case where this isn't the case?).
I don't know - what do you think? My senses are we should support official Gitlab, and if on-prem isn't too hard, we should strive for that too. |
Status update:
The other shpc asset is the general template scripts (i.e. ones that can be shared between recipes and therefore are not in the same directory as |
I got the CI to work ! It was doing a |
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.
I think that's all I wanted to test. I'll create issues with additional features that can be addressed later
shpc/main/registry/remote.py
Outdated
if not self.source.startswith("http"): | ||
self.source = "https://%s" % self.source | ||
|
||
# Check for API | ||
org, repo = self.source.split("/")[3:] | ||
gh_pages = "https://%s.%s.io/%s/library.json" % (org, self.provider_name, repo) | ||
response = requests.get(gh_pages) | ||
if response.status_code != 200: | ||
sys.exit( | ||
"Remote %s is not deploying a Registry API. Open a GitHub issue to ask for help." | ||
% self.source | ||
) |
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.
if not self.source.startswith("http"): | |
self.source = "https://%s" % self.source | |
# Check for API | |
org, repo = self.source.split("/")[3:] | |
gh_pages = "https://%s.%s.io/%s/library.json" % (org, self.provider_name, repo) | |
response = requests.get(gh_pages) | |
if response.status_code != 200: | |
sys.exit( | |
"Remote %s is not deploying a Registry API. Open a GitHub issue to ask for help." | |
% self.source | |
) | |
url = self.source | |
if not url.startswith("http"): | |
url = "https://%s" % url | |
if url.endswith(".git"): | |
url = source[:-4] | |
# Check for API | |
url_parts = url.split("/")[3:] | |
gh_pages = "https://%s.%s.io/%s/library.json" % (url_parts[0], self.provider_name, "/".join(url_parts[1:])) | |
response = requests.get(gh_pages) | |
if response.status_code != 200: | |
sys.exit( | |
"Remote %s is not deploying a Registry API (%s). Open a GitHub issue to ask for help." | |
% (self.source, gh_pages) | |
) |
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.
Can you walk me through this change? Why wouldn't we want to change the source (for good) with a proper https url?
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.
About this particular change, I actually don't understand why the source would not start with https://
at this stage, since the constructor checks that and raises an error.
That's why I had suggested to remove it in https://github.com/singularityhub/singularity-hpc/pull/579/files#diff-183e41e47a9fe06125f88dd47d33eb5bc399a6458ad3bc0e8d5c98e422179239L147-L148
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.
I did that because a person may just want to specify it as github.com/<org>/<name>
. I don't see that the constructor checks and throws an error, it seems to just set it:
self._url = self.source |
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.
The check happens in the super-class
singularity-hpc/shpc/main/registry/provider.py
Lines 35 to 40 in f948e4e
def __init__(self, source, *args, **kwargs): | |
if not (source.startswith("https://") or os.path.exists(source)): | |
raise ValueError( | |
"Registry source must exist on the filesystem or be given as https://." | |
) | |
self.source = source |
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.
But not to get distracted with this check, which could be argued is redundant (but certainly isn't causing any major issues?) - can you explain the changes in the above? What problem is it fixing? I think we are close and (things look generally ok) and could merge/release soon.
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.
The patch is to allow support for "groups" in gitlab, cf your message (#576 (comment)):
and in the meantime if you want to share the update to match "org" and "repo"
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.
with groups, the url is https://gitlab.com/group/sub-group/repo.git
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.
Ah gotcha, thank you for clarifying! Let me see if I can organize the functions a bit - brb!
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.
okay check out 1f29489. !
FYI I will not create an issue to support cloning over ssh, as the only advantage I think it'd bring is being able to clone private repositories. But shpc anyway requires a public library.json, which defeats the purpose of keeping the registry private. |
@muffato I think we could have support for that still, it just would be a different kind of clone (and show/list would do a directory listing instead of library.json). |
🤔 . You also said
I'm confused 😅 ! |
There are two different cases here:
It could be the case that a public GitHub/GitLab registry is allowed to not have a library.json, but I'd rather (to start) force people to start with my template to use a (better) practice of having the library easily seen. The reason is because along with the API, it provides a user interface for recipes: https://singularityhub.github.io/shpc-registry/. |
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
@muffato let me know if you have more questions for the review! Apologies my responses are a bit scattered. |
I get from your previous message that you don't see the registry providing a pseudo API and |
Yes absolutely, I do think we should support this - encourage folks to provide the extra metadata but it shouldn't be a hard requirement. Open away!
|
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.
Can you add to the developer guide instructions for making your own registry ? (especially setting up the CI)
docs/getting_started/user-guide.rst
Outdated
|
||
Use the default | ||
|
||
TODO WRITE THESE OUT SHOW HOW TO UPDATE |
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.
Is it still TODO ?
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.
lol, I think I just totally forget - yes let me add a few lines!
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.
See da4c91c !
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
giphy.gif.mp4 |
This is a huge PR to replace #567 that will make the default registry remote, and add the concept of a registry backend, either remote (GitHub) or a local filesystem. I've done careful work to ensure all tests try both cases, but likely this will need a lot of manual testing to be double sure I didn't break anything!