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 subdirectory registration functionality #287

Merged
merged 11 commits into from
Apr 27, 2020
Merged

Add subdirectory registration functionality #287

merged 11 commits into from
Apr 27, 2020

Conversation

SebRollen
Copy link
Contributor

@SebRollen SebRollen commented Apr 23, 2020

Draft pull request for allowing subdirectory registration with Registrator.jl. So far, I've only tackled the registration piece from comments, but will tackle web-ui registration (if needed, I've never used it so not sure what the process looks like) and the approval call next, but I figured I'd open this up for discussion. The keyword for registering a subdirectory is
@bot register subdir=path/to/package

Resolves #230
This is currently dependent on a yet-to-be-merged branch of RegistryTools, here

@DilumAluthge DilumAluthge requested a review from nkottary April 23, 2020 23:40
@DilumAluthge
Copy link
Member

@nkottary can you review this?

@GunnarFarneback it would be great if you could also review this?

@SebRollen
Copy link
Contributor Author

Update: I've verified that the approval process now works, and that the tag created is in the format discussed in #230, i.e. {Package}-v{version}. If the subdir argument is not used, the tag remains v{version}

@SebRollen
Copy link
Contributor Author

SebRollen commented Apr 24, 2020

Spun up a registry and repo to do some testing, looks like everything is working pretty well:

  1. Base package registration:
    Issue: Register Base package SebRollen/TestRepo.jl#1
    Registry PR: New package: TestRepo v0.1.0 SebRollen/TestRegistry#1
    Tag: https://github.com/SebRollen/TestRepo.jl/releases/tag/v0.1.0

  2. Subdirectory package
    Pull request: Update Project.toml SebRollen/TestRepo.jl#2
    Registry PR: New package: PackageA v0.1.1 SebRollen/TestRegistry#2
    Tag: https://github.com/SebRollen/TestRepo.jl/releases/tag/PackageA-v0.1.1

  3. Deeply nested subdirectory package
    Issue: Register deeply nested package SebRollen/TestRepo.jl#3
    Registry PR: New package: PackageB v0.1.0 SebRollen/TestRegistry#3
    Tag: https://github.com/SebRollen/TestRepo.jl/releases/tag/PackageB-v0.1.0

Gonna flip this from draft to normal PR as I think it's ready for review

Edit:
Leaving this comment as a reminder to myself that I still need to fix the commentbot's original PR comment regarding tagging, e.g. SebRollen/TestRepo.jl#3 (comment). The tag hint should incorporate the suggested tag name, i.e. the suggested tag name for version v1.2.3 of subdirectory PackageA should be PackageA-v1.2.3

@SebRollen SebRollen marked this pull request as ready for review April 24, 2020 02:59
@@ -84,5 +87,5 @@ function verify_projectfile_from_sha(reponame, sha; auth=GitHub.AnonymousAuth())
end
end

return project, t.sha, projectfile_found, projectfile_valid, err
return project, sha, projectfile_found, projectfile_valid, err

Choose a reason for hiding this comment

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

The returned sha is only correct for the subdir case. Otherwise the input commit sha is returned rather than the tree sha for the top directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch! I fixed it here: e39cc8d

@SebRollen
Copy link
Contributor Author

Okay, I spun up my registry server again to test the updates to the SHA for top-level repo packages as well as the updated comments from the commentbot, looks good to me.

  1. Testing that we now have the correct SHA for top-level repos
    PR: Update Project.toml SebRollen/TestRepo.jl#4
    Registry PR: New version: TestRepo v0.1.1 SebRollen/TestRegistry#4
    Tag: https://github.com/SebRollen/TestRepo.jl/releases/tag/v0.1.1

  2. Testing that the commentbot now suggests the correct tag for manual tagging.
    PR: Update Project.toml SebRollen/TestRepo.jl#5
    Registry PR: New version: PackageA v0.1.2 SebRollen/TestRegistry#5
    Tag: https://github.com/SebRollen/TestRepo.jl/releases/tag/PackageA-v0.1.2

@debug("Getting tree object for sha")
t = tree(reponame, Tree(gcom.tree); auth=auth)
t = tree(reponame, Tree(gcom.tree); auth=auth, params = Dict(:recursive => true))

Choose a reason for hiding this comment

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

Would it be worth only activating recursive in the subdir case? Otherwise there is no need to transfer all the deeper data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, probably good to limit the data transfer when it's not needed. Fixed in 06747a2

@SebRollen
Copy link
Contributor Author

Incorporated the updates from JuliaRegistries/RegistryTools.jl#33 into the Manifest. Tests seem to pass, but I have still not tested with the webui, as I don't have that spun up on my own registrator server. I think everything should still work on there as the subdir option has a default, though the webui would obviously not have the option to register a subdirectory

Copy link

@GunnarFarneback GunnarFarneback left a comment

Choose a reason for hiding this comment

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

The parts of the PR I have any insights in look good to me.

@nkottary
Copy link
Member

@SebRollen Can you add some documentation on this feature in README.md? This can be a section after "Note on documentation build" in the "How to use" section

@SebRollen
Copy link
Contributor Author

@nkottary, added a section on subdirectory registration to the README

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.

Allow registering packages in a subdir of the main repo directory
4 participants