#1105 Add the git hook to allow mirroring a repo to one or more location
Closed by pingou. Opened by pingou.
mirroring  into  master

Download 1105.patch

Fixes https://pagure.io/pagure/issue/537

Still needs:

  • doc
  • tests

I can either update this PR or make a new one, as is more convenient :)

rebased

Do you need to re-add them every time?
I think that this might be going to error if it was already added before?

Don't you need to indicate --mirror here to make sure the push doesn't come back with "please pull first"?

I think it might be useful to add all this debugging to some database field and let that display i nthe web interface, so that users can still see it even if we don't want full-blown general debugging turned on.

Why this? ssh://$server/$directory works pretty well, even if it's not the "default" for GitHub and the likes.

Doesn't the private_key object have a .public_bytes()?

It will error but that's fine since we don't actually check the output :)

So I don't need --mirror here since I specified --mirror=push when adding the remote

Because it's easier for me to use standardized URLs all having the same format

Fair enough

Not from what I read on the doc, maybe I missed it

Ah! Today I learned :).

Sorry :(

:D

It's a good idea but then we would need to adjust all the plugins so that would be outside the scope of this PR I think (but worth opening a ticket for)

rebased

rebased

rebased

6 new commits added

  • Clean the public_key in the DB when removing the mirroring hook
  • Always write the ~/.ssh/config file
  • Drop the other OpenSSL keys from the serialization since we only use RSA
  • Fix uninstalling the mirroring hook
  • Make the backref from project to mirror_hook to point to only 1 project
  • Backport from a newercrytography the method to serialise public ssh key

rebased

rebased

9 new commits added

  • Use returns instead of sys.exit()
  • Add systemd unit file for pagure-mirror
  • Add a README to pagure-mirror
  • Improve the mirror hook
  • Retrieve the absolute path to the repo sent by the server
  • Adjust the pagure-ci service to save the push log in the DB
  • Adjust the pagure_mirror hook to include a last_log field
  • Adjust the mirror_hook plugins to work together with pagure-mirror
  • Add a new service: pagure-mirror

1 new commit added

  • Rename the pagure-mirror server to pagure_mirror_server as it should be

rebased

rebased

rebased

rebased

Perhaps add a comment that this is because this code is only in a too new version of pyca?

Please note that some people might also provide ssh://user@test:whatever.git themselves, which means that you might not need to do a / -> : replacement... Perhaps just look up the very first "/ or :", and only do the replacement if that was a /?

just look up the very first "/ or :", and only do the replacement if that was a /?

Not sure I parse that entirely :)

Instead of mucking with the .ssh/config file, which would make it difficult to have two projects use the same remote server, I would suggest just passing "GIT_SSH_COMMAND='ssh -i $privatekey'" environment variable during the push.

rebased

Fixed as part of https://pagure.io/pagure/pull-request/3296

Pull-Request has been closed by pingou

Metadata