How to install delete-project plugin in gerrit?
Asked Answered
P

5

12

I want to install delete-project plugin to my gerrit server. As per the latest version, I should clone it from google source and use buck build.

I cloned it and my buck is also ready.

What are the steps to be followed to build the delete project plugin and add it to my gerrit server.

I tried

buck build .

in the cloned source of delete-project. But, I am getting the following error

Traceback (most recent call last):
  File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 872, in <module>
    main()
  File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 867, in main
    buildFileProcessor.process(build_file.rstrip())
  File "/home/gerrit/buck/src/com/facebook/buck/parser/buck.py", line 800, in process
    build_env['BUILD_FILE_SYMBOL_TABLE'])
  File "/home/gerrit/delete-project/././BUCK", line 1, in <module>
    gerrit_plugin(
NameError: name 'gerrit_plugin' is not defined
BUILD FAILED: Parse error for BUCK file ././BUCK: End of input at line 1 column 1

Please help

Pleasance answered 21/1, 2014 at 9:40 Comment(0)
T
14

I managed to install delete-project plugin after following this thread:

https://groups.google.com/forum/#!topic/repo-discuss/hbBc2TUhl7s

and then install according to:

https://gerrit-review.googlesource.com/Documentation/cmd-plugin-install.html

P.S. I build the jar following the below steps:

  1. git clone --recursive https://gerrit.googlesource.com/gerrit
  2. cd gerrit
  3. git clone --recursive https://gerrit.googlesource.com/plugins/delete-project
  4. buck build delete-project:delete-project

You should then find the delete-project.jar in buck-out/gen/delete-project/delete-project.jar

Tiedeman answered 12/2, 2014 at 8:8 Comment(5)
Whenever i run buck build delete-project:delete-project i get OSError: [Errno 2] No such file or directory (/usr/lib/python2.7/subprocess.py any idea why? I have the subprocess.py libDobbins
@TimCastelijns: Are you using Arch Linux? That error occurs because the system's /usr/bin/python is Python 3, not Python 2. What you can do is create a directory like ~/bin, symlink Python 2 into it (ln -s /usr/bin/python2 ~/bin/python), and then run buck with PATH="~/bin:$PATH" buck ...Airlia
@Xiao-LongChen using ubuntu server 14.04 and /usr/bin/python --version gives Python 2.7.6Dobbins
Would you mind posting the full build log? The subprocess module might be failing because it's trying to run a program that doesn't exist.Airlia
Add --recursive option to git clone in Step 1 if you want to install one of the plugins included by default in gerrit repository. It'll download all the submodules. Please also note that above steps aren't sufficient when you installed gerrit from *.war file. In that case do above steps as a side project, build plugin *.jar files and copy them to your production gerrit.Cording
B
14
  1. Download the delete-project.jar from the build that matches your Gerrit version on https://gerrit-ci.gerritforge.com
  2. Copy it to gerrit/plugins directory.
  3. Restart Gerrit.
Boyhood answered 26/4, 2016 at 9:29 Comment(1)
Select the Plugins-stable-2.xx tab matching your Gerrit version to find the correct plugin-delete-project build job.Leanaleanard
M
2

I managed to successfully build delete-project plugin with a slight modification on @DavidCheung answer:

  1. git clone https://gerrit.googlesource.com/gerrit
  2. cd gerrit/plugins
  3. git clone https://gerrit.googlesource.com/plugins/delete-project
  4. buck build delete-project:delete-project

You should then find the delete-project.jar in ../buck-out/gen/delete-project/delete-project.jar

Manaus answered 30/6, 2015 at 17:2 Comment(0)
T
1

I struggled with the answers above, maybe due to having a new version of Gerrit (2.11.2). The steps in this document all worked for me, with one addition - you need to add the --recursive flag when you clone the Gerrit source code so that it includes the source for the standard plugins:

git clone --recursive https://gerrit.googlesource.com/gerrit

Also, make sure to check out the correct Git branch for your Gerrit version,e.g.

git fetch origin stable-2.11:stable-2.11
git checkout stable-2.11
Treasurehouse answered 18/8, 2015 at 23:52 Comment(0)
S
0

This is how to build a delete-project.jar for gerrit 3.x.

  1. Install bazel.
  2. Download gerrit source code with git clone --recursive https://gerrit.googlesource.com/gerrit
  3. cd gerrit
  4. bazel build plugins/delete-project:delete-project

The last step will generate bazel-bin/plugins/delete-project/delete-project.jar which then can be installed as described in the official documentation.

Sememe answered 17/3, 2021 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.