•  
      request #7384 Restore archived gitolite repositories from siteadmin
    Infos
    #7384
    Mohamed Amin Doghri (doghrim)
    2015-04-30 17:31
    2014-08-28 16:02
    7389
    Details
    Restore archived gitolite repositories from siteadmin
    Hello ,

    We want to allow siteadmin to restore deleted gitolite repositories already archived . (Archiving deleted repositories was announced in

    https://tuleap.net/plugins/tracker/?aid=7363 and we are doing internal code review for it.)
    Description of above feature :
    -In "Site Administration interface / Project administration section , user search for project
    -Click on [show pending documents] : it's better to change it to ([show pending items])
    -In "Pending deleted documents for project xxx" we will add "Deleted Git repositories" tab
    -In this section we will show the list of deleted Git repositories that are backuped.
    -For each one we will display :
    *It's name
    *Creation date
    *Created by (user name)
    *Deletion date
    *A button to restore the repository
    *A button to completely remove the repository from the staging area

    What do you think ?

    BR
    Amin
    SCM/Git
    Empty
    Empty
    • [x] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Mohamed Amin Doghri (doghrim)
    Closed
    2015-04-30
    Attachments
    Empty
    References

    Follow-ups

    User avatar
    dylan bowden (dylan)2015-03-13 17:22
    Hi,

    we have an idea to solve the possible concurrency issue. I'm going to write a changeset on top of yours that will modify things as follows.

    1. As codendiadm
    2. chgrp gitolite backup.tar.gz -> this changes the group so that gitolite has rights on the file. - use System_Command::exec().
    3. As gitolite
    4. Untar the file.
    5. As codendiadm
    6. Update the gitolite config

    All this can be done with the owner 'app'.

    I will then merge both commits together.
    User avatar
    dylan bowden (dylan)2015-03-11 14:01
    As discussed via chat, the patch is ok but we need to figure something out surrounding concurrent events via the app and root owners of events for the same queue. I'll get back to you.
    User avatar
    The proper way to do it is to have a RESTORE event lauched as root so it can restore the files and run the chown (see BackendSystem for this)
    Then, once this RESTORE is done, there should be another even (lauched as APP) to re-update the repo definition (probably just launche GIT_REPO_UPDATE should be enough)

    For the RESTORE part, ideally it should be in git queue but as of today there is no way to execute an event of git queue as root. I think the easiest way is to launch it in main/default queue.
    User avatar
    Hello ,

    I've an issue in this restore feature. In fact I was able to restore repositories with wrong ownership (codendiadm:codendiadm instead of

    gitolite:gitolite) , Is there any method inside git plugin that allow me to change repository ownership ?

    "chown" command doesn't work due to user permission (codendiadm) is not able to change ownsership.

    I've tried to run Restore systemevent with root, but it was blocked to "new" status and when running it with "app" it works well except this

    ownership issue.

    You could try my code in http://gerrit.tuleap.net/#/c/3003/

    Thing that is not clear to me is how tuleap fix right ownership (gitolite:gitolite) when creating repository with system event running with app user

    (normally codendiadm) ?
    If you look at "/usr/share/tuleap/plugins/git/include/events/SystemEvent_GIT_REPO_UPDATE.class.php" you will see that inside process method

    we have one call that seems to be responsible for repo creation wich is :
    $repository->getBackend()->updateRepoConf($repository);

    In my restore code I've already call this method but it doesn't change the ownership to gitolite:gitolite

    Thanks to help
    Amin
    User avatar
    >>>Does the archived repositories will be automatically purged after a given amount of time like other items?
    Yes (it will be announced in other artifact linked to #7363), and in this case we don't need manual deletion from siteadmin interface.

    >>>When the repository is archived/restored, what happen on the gerrit server side?
    Nothing since the repository should be disconnected from Gerrit before it's deletion .

    >>>Something that I did not ask in the previous request:
    >>>- Does the user have the choice between archive and delete action or is there only one action archive?
    Archiving is automatic after reporitory deletion, so nothing will change from user side, he will have only "delete" button and no other choice.
    User avatar
    Does the archived repositories will be automatically purged after a given amount of time like other items?

    When the repository is archived/restored, what happen on the gerrit server side?

    Something that I did not ask in the previous request:
    - Does the user have the choice between archive and delete action or is there only one action archive?

    • Status changed from New to Acknowledged