Introduce an archiving mechanism for deleted repos

So far, if the preserveGitRepository option was set to false, once a
repository was deleted, there was no way to recover it. Even if this
makes sense, mistakes happen and it could be handy to have a backup
mechanism when they occur. Besides, in some environments it could be
desirable to give end users the permission to delete their own projects
as this reduces the administrative tasks. In this case, being able to
recover mistakenly deleted repositories could be even more critical.

Introduce a new option to archive a repository instead of deleting it.
This will allow the administrators to recover the git repositories in
case of deletion by mistake. From the user point of view, and even for
Gerrit, the repository is deleted as it is no longer available given it
is moved to a different name and under a different, configurable named,
folder.

The archived repositories are kept for a configurable amount of time
after which they are deleted; the auto-cleaning of the archived git
repositories is done periodically, i.e., once a day.

Three new configuration fields are added to customize the behaviour of
this feature:

  - archiveDeletedRepos: whether to enable this feature. By default
    false.
  - archiveFolder: the path of the target archive folder. By default,
    the plugin data folder.
  - deleteArchivedReposAfter: the time period to keep the archived git
    repositories. By default, 180 days. If archiveDeletedRepos is true
    but this values is set to 0, the periodic task will not run and the
    archived repositories need to be cleaned manually or using an
    external task.

Change-Id: I62985e8ffa5e3300c6927507e793dffd7aa2e54c
11 files changed
tree: 7da4ba277633f0227b83d224ef05abaf314292c9
  1. .settings/
  2. src/
  3. tools/
  4. .bazelrc
  5. .gitignore
  6. bazlets.bzl
  7. BUILD
  8. external_plugin_deps.bzl
  9. README.md
  10. WORKSPACE
README.md

Delete project plugin for Gerrit Code Review

A plugin which allows projects to be deleted from Gerrit via an SSH command, REST API or the Project settings screen.

Build Status