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 maintaining local registries #45

Closed
wants to merge 6 commits into from

Conversation

adamslc
Copy link

@adamslc adamslc commented Apr 2, 2019

This seems to work, but I'm not very attached to the way everything is done here. If you would prefer it in a separate package (apart from the refactoring), then feel free to say so.

Todo:

  • Tests
  • Better error handling

adamslc added 4 commits April 2, 2019 11:13
This new method is intended to be used interactively to manage private
repositories.
@nkottary
Copy link
Member

nkottary commented Apr 4, 2019

Thank you for making this much needed refactor!

You still need to route the users request to this new register method. This happens here: https://github.com/JuliaComputing/Registrator.jl/blob/9023c098db39b5343eaed4f0f6050b934d4161a3/src/Server.jl#L803

Maybe you can have a local boolean flag in the config here: https://github.com/JuliaComputing/Registrator.jl/blob/9023c098db39b5343eaed4f0f6050b934d4161a3/image/scripts/sample.toml#L16 and when that is set you call the new register method.

@adamslc
Copy link
Author

adamslc commented Apr 4, 2019

I was intending for this to be used interactively at the REPL like the mockup in this discourse comment. It's not clear to me what the workflow should be for someone running a Registrator server, and wanting to locally tag releases. Could you elaborate?

adamslc added 2 commits April 4, 2019 16:47
 *  Switch to git add --all to fix a problem when the registry directory
    is relative.
 *  Don't try to print the empty packages section using TOML.print
    because it discards empty sections.
@nkottary
Copy link
Member

nkottary commented Apr 5, 2019

In that case, its fine.

I was thinking (as an example) the registry is on a distributed file system that an org would access for its project. Registrator would listen to GitHub comments on the package repo and just make commits accordingly on the registry.

@ianfiske
Copy link

ianfiske commented Apr 5, 2019

Looks like this PR will be perfect for use in a CI script to allow organizations to register versions and create private registries in platform-independent manner.

@debug("Verifying package name and uuid in deps")
for (k, v) in pkg.deps
u = string(v)
if haskey(registry_data["packages"], u)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does registry_data come from? I can't see it defined in this function.

throw(err)
end
else
err = "Error in `[deps]`: Package '$k' with UUID: $u not found in registry or stdlib"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this only works if all non-stdlib dependencies are within the same registry. It would be good to support other scenarios, in particular the case of a private registry that allows external dependencies both in stdlib and the General registry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed in #67

length(remote_name) > 1 && throw("Repository has multiple remotes.")
# TODO: Handle this case?
remote_name[1] == "" && throw("Repository does not have a remote.")
return read(`$git remote get-url $(remote_name[1])`, String)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should chomp the ending newline? (readchomp can be used directly if the String argument is removed.)

@GunnarFarneback
Copy link

I guess this PR is in a rather bad state of conflicts at this point and that local registry maintenance will need a retake when other things settle. However, those who need that functionality now are welcome to try https://github.com/GunnarFarneback/Registrator.jl, which adds some finishing touches on top of this PR. It's obviously an evolutionary dead end though.

@timholy
Copy link
Member

timholy commented Apr 19, 2019

@GunnarFarneback, your repo is quite useful, many thanks.

Would love to see this "official" version finished off.

@oschulz
Copy link

oschulz commented Jun 17, 2019

I really like this! This would be very useful to us. I'm planning to run a small custom registry for a physics collaboration (public, actually, but the packages are way too application-specific for Julia general), and I have the impression that this PR would make it much easier to maintain without running and maintaining a Registrator server.

@schlichtanders
Copy link

schlichtanders commented Jan 16, 2020

I just started using the version by @GunnarFarneback and liked it very much
unfortunately it still has a couple of missing things. Three bugs I encountered so far:

  • if no change was made, the register function will crash because the commit is empty and crashes therefore (it would be great if this does not trigger an error, as everything is fine, so that execute the registration twice still works)
  • if used on Windows, the paths stored into the Registry.toml are NOT working on mac or linux but a doublebackslash \\ gets used as the path divider (of course here one has to use normal forwardslash divider / which works cross-platform)
  • create_registry(path, repository) is described to get a path object as first argument (both in the function doc as well as on the top README https://github.com/GunnarFarneback/Registrator.jl). However this fails as soon as you instantiate the registry somewhere else, as the path is actually used as the name of the registry and hence running registry add ... will install it under ~/.julia/registries/C:/Users/.../.julia/registries/MyName for instance. Workaround: interpret path argument as name.

so this still needs a couple of fixes and for this it would be great to have only one Registrator in order to go forward here

where should I propose such fixes?

@schlichtanders
Copy link

let me highlight that this is a super crucial package for adoption of julia

background: I just read up about how to deal with a development status and the result is that you better use a private registry if you want to work with private packages on several computes or with several people. Specifically, just using add/dev is still hacky to JuliaLang/Pkg.jl#1005

Hence getting this package Registrator ready seems crucial for everyone to develop their own packages. I hope it gets some priority soon.

Next to having no Linter in Juno, this is one of the most unsupported parts of julia while still being super crucial for adoption (at least in my opinion).
Please give it a priority

@timholy
Copy link
Member

timholy commented Jan 16, 2020

where should I propose such fixes?

Best option would be to fix up this PR and get it into a merge-worthy state. Want to give it a try @schlichtanders?

@fredrikekre
Copy link
Member

Note: I think most of the registry handling functionality has moved to https://github.com/JuliaRegistries/RegistryTools.jl so this PR should probably target that instead. Note also https://github.com/JuliaRegistries/RegistryTools.jl was moved out such that it could be used to rewrite https://github.com/JuliaLang/PkgDev.jl so the functionality you are after might already exist in PkgDev.

@DilumAluthge
Copy link
Member

@davidanthoff can probably answer whether or not this functionality ("support for maintaining local registries") currently exists in PkgDev.jl.

@StefanKarpinski
Copy link
Contributor

There were a number of complaints about the quality of Registrator and that it was "not fit for open source". It's quite difficult to keep it running as a production service and satisfy all the things people want to do with it as an open source project. Rather than keep trying to do that—and apparently failing—this package should be effectively considered legacy now. Julia Computing is still running an instance of it to help manage General registrations, but the project you should contribute to and use for your registries is RegistryTools.

@schlichtanders
Copy link

thanks for the clarification.

Unfortunately, https://github.com/JuliaRegistries/RegistryTools.jl is not fully documented yet it seems.

@GunnarFarneback
Copy link

where should I propose such fixes?

I am willing to merge bugfix PRs to my fork for the short term but clearly the long-term future is elsewhere. It's difficult to guess the scope of RegistryTools but if this functionality doesn't fit there in its entirety, the best solution is probably to start a new package for the purpose, which likely would be a rather thin wrapper around RegistryTools.

@davidanthoff
Copy link
Contributor

https://github.com/JuliaLang/PkgDev.jl in principle supports local registries, we use it with one.

There are two issues right now with PkgDev.jl:

  • The PRs it opens against the General registry are not auto-merged. I don't really know how to solve that.
  • In general it is not the most robust code out there :) I try to handle a number of corner cases, but I think it generally needs to be hardened a bit more before it could be advertised for general use.

Other than that I much prefer the workflow of it vs the JuliaRegistrator story, because it also handles increasing version numbers in Project.toml etc. Releasing a new version just literally becomes Pkg.tag("MyPackage"), versus the current 1) increase the version in Project.oml, 2) commit, 3) push, 4) trigger the registrator bot etc.

@ianfiske
Copy link

Glad to see this thread is getting picked up again.

The biggest drawback I see with the current PkgDev story is that it is Github-specific. Would be great if we can separate out the GH-specific parts so that it would work with other git hosting providers if needed. Would be great to either additionally support Gitlab or just generic git (which removes the "create pull request" part).

I can take a look at this when I have time to see what it would take to contribute this change. What such a change be welcome/desired?

@davidanthoff
Copy link
Contributor

What such a change be welcome/desired?

YES, very much! I think we should first get the GitHub story more stable, and start to have some test story, but in principle I would love to see support for other hosting solutions as well.

Could you maybe open an issue over at PkgDev.jl for this discussion? Probably best to have that over there.

@GunnarFarneback
Copy link

I am willing to merge bugfix PRs to my fork for the short term but clearly the long-term future is elsewhere.

The short term ended early. That fork is now discontinued.

It's difficult to guess the scope of RegistryTools but if this functionality doesn't fit there in its entirety, the best solution is probably to start a new package for the purpose, which likely would be a rather thin wrapper around RegistryTools.

The functionality of the fork is instead available in LocalRegistry, which so far has added some minor improvements, off-loaded a small part of the code to RegistryTools, and added testing.

@ianfiske
Copy link

@davidanthoff Thanks for the enthusiasm -- I just added JuliaLang/PkgDev.jl#164 for this.

@GunnarFarneback -- This is awesome. Thank you for putting this together. I had something private that relied on your old defunct branch for the purpose. I'll try out your new LocalRegistry package soon to see if it works for us.

@schlichtanders
Copy link

@GunnarFarneback so I guess bug-reports like #45 (comment) should be going to LocalRegistry?

@GunnarFarneback
Copy link

Yes, although I just might have fixed those particular ones already.

@GunnarFarneback
Copy link

Between RegistryTools, PkgDev, and LocalRegistry (now registered) I think this can be closed.

@timholy
Copy link
Member

timholy commented Mar 23, 2020

LocalRegistry has been very reliable for me, thanks so much for contributing it!

@oschulz
Copy link

oschulz commented Mar 23, 2020

LocalRegistry has been very reliable for me, thanks so much for contributing it!

I'd like to second that, LocalRegistry is very very helpful!

@ianfiske
Copy link

Likewise, I should have followed up earlier -- LocalRegistry is working great for us and covering our needs on this front.

@adamslc adamslc closed this Apr 15, 2021
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 this pull request may close these issues.