1 Overview
Ways to delete project in gerrit:
a.delete git repositories in gerrit server
b.delete-project plugin
2. Delete git repositories
check gerrit repositories path in gerrit /etc/gerrit.config
cd the basePath and find the project you want to delete, delete it.
3 delete-project plugin
3.1 Build delete-project plugin
3.1.1 Build tools
# install ant
sudo apt-get install ant
# install buck
git clone https://gerrit.googlesource.com/buck
cd buck
ant
# update bash setup script to make buck and buckd available
ln -s /home1/Gama/local/buck/bin/buck /home1/Gama/bin/buck
ln -s /home1/Gama/local/buck/bin/buckd /home1/Gama/bin/buckd
export PATH=$PATH:/home1/Gama/bin
3.1.2 Prepare the source code
# Check out Gerrit source code
git clone https://gerrit.googlesource.com/gerrit
cd gerrit
# Switch to the tag matching your Gerrit server.
# You must use the same version to build plugins compatible to the server.
git checkout v2.12.2
#Check out the source code of delete-project
cd plugins
git clone https://gerrit.googlesource.com/plugins/delete-project
cd delete-project
# Switch to the most recent, possible commit matching the version of the server.
# Things are better with 2.9, but there's no tag or branch for 2.8.
# From https://gerrit.googlesource.com/plugins/delete-project/+/stable-2.12 we know commit id is 5647220a84382d30a1dd7d66e9dc20a7411c9a4d
git checkout 5647220a84382d30a1dd7d66e9dc20a7411c9a4d
3.1.3 Build plugin
# At the root directory of the gerrit repository
buck build plugins/delete-project:delete-project
After building, there isdelete-project.jarinbuck-out/gen/plugins/delete-project/.
3.2 Install plugin
# ssh command install if gerrit plugin install enabled
$ssh -p ${GERRIT_PORT} ${GERRIT_USER}@${GERRIT_HOST} gerrit plugin install -n delete-project.jar - < delete-project.jar
# if gerrit disable plugin install remote, just cp plugins to gerrit plugins directly
$scp ./buck-out/gen/plugins/delete-project/delete-project.jar gerrit2@10.80.98.62:/data/gerrit2/review_site/plugins
# stop and start gerrit service the enable new install plugins available
$./data/gerrit2/review_site/bin/gerrit.sh restart
after gerrit service restart, you can check the plugin status in web.
3.3 Use plugin
3.3.1 ssh command
# Find the project name we want to delete
$ ssh -p 29418 10.80.98.62 gerrit ls-projects --all
# the deleteproject command default to dry-run, not really delete
$ ssh -p ${GERRIT_PORT} ${GERRIT_USER}@${GERRIT_HOST} deleteproject delete $PROJECT
# add --yes-really-delete after ensure to delete
$ ssh -p ${GERRIT_PORT} ${GERRIT_USER}@${GERRIT_HOST} deleteproject delete $PROJECT --yes-really-delete
3.3.2 WebUI
Document:http://10.80.98.62:8089/Documentation/intro-project-owner.html#project-deletion
4 Suggestion
You can use other ways to get the samepurpose as delete the project, change the project state to Read Only or Hidden for example.
5 Refer to
Gerrit Code Review - Building with Buck
java - How to install delete-project plugin in gerrit? - Stack Overflow
https://gerrit.googlesource.com/plugins/delete-project/
http://sychen.logdown.com/posts/2014/12/28/delete-project-in-gerrit