cannot build Gerrit plugins using bazel

424 views
Skip to first unread message

Humberto Israel Perez Rodriguez

unread,
Aug 10, 2018, 2:10:53 AM8/10/18
to Repo and Gerrit Discussion
Affected Version:
2.14.8

What steps will reproduce the problem?
1. install bazel
2. try to build any Gerrit plugin
3. cannot build any Gerri plugin

What is the expected output?
Gerrit plugin builded with bazel should be successful


What do you see instead?
Gerrit plugin builded with bazel it nos successful



Please provide any additional information below.


I am trying to figure out how to build a Gerrit plugin with bazel (Any plugin) since all time have the following errors

What is the output of the JS console log (if applicable)?

>>> bazel build commit-message-length-validator                                     
Starting local Bazel server and connecting to it...
 .............
ERROR: Skipping 'commit-message-length-validator': error loading package '': Extension file not found. Unable to load package for '//tools/bzl:plugin.bzl': BUILD file not found on package path
WARNING: Target pattern parsing failed.
ERROR: error loading package '': Extension file not found. Unable to load package for '//tools/bzl:plugin.bzl': BUILD file not found on package path
INFO: Elapsed time: 0.665s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
currently loading:


>>> bazel build commit-message-length-validator:commit-message-length-validator
ERROR: Skipping 'commit-message-length-validator:commit-message-length-validator': no such package 'commit-message-length-validator': BUILD file not found on package path
WARNING: Target pattern parsing failed.
ERROR: no such package 'commit-message-length-validator': BUILD file not found on package path
INFO: Elapsed time: 0.209s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)



I am trying to figure out how to build a Gerrit plugin with bazel (Any plugin) since all time have the following errors

>>> bazel build commit-message-length-validator                                     
Starting local Bazel server and connecting to it...
 .............
ERROR: Skipping 'commit-message-length-validator': error loading package '': Extension file not found. Unable to load package for '//tools/bzl:plugin.bzl': BUILD file not found on package path
WARNING: Target pattern parsing failed.
ERROR: error loading package '': Extension file not found. Unable to load package for '//tools/bzl:plugin.bzl': BUILD file not found on package path
INFO: Elapsed time: 0.665s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
currently loading:


>>> bazel build commit-message-length-validator:commit-message-length-validator
ERROR: Skipping 'commit-message-length-validator:commit-message-length-validator': no such package 'commit-message-length-validator': BUILD file not found on package path
WARNING: Target pattern parsing failed.
ERROR: no such package 'commit-message-length-validator': BUILD file not found on package path
INFO: Elapsed time: 0.209s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)


Asking here in order 
to receive some kind of help over this.

Thanks

Gerrit plugins: https://review.openstack.org/Documentation/config-plugins.html

for more information please visit: https://bugs.chromium.org/p/gerrit/issues/detail?id=9548&can=2&start=0&num=100&q=&colspec=ID%20Type%20Stars%20Milestone%20Status%20Priority%20Owner%20Summary&groupby=&sort=

David Ostrovsky

unread,
Aug 10, 2018, 6:40:07 AM8/10/18
to Repo and Gerrit Discussion

Am Freitag, 10. August 2018 08:10:53 UTC+2 schrieb Humberto Israel Perez Rodriguez:
Affected Version:
2.14.8

What steps will reproduce the problem?
1. install bazel
2. try to build any Gerrit plugin

You missed:

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

3. cannot build any Gerri plugin

I think the reason for that failure was also explained in this comment [1].

[1] https://bugs.chromium.org/p/gerrit/issues/detail?id=9548#c7

Gert van Dijk

unread,
Aug 10, 2018, 6:58:31 AM8/10/18
to Repo and Gerrit Discussion

On Friday, 10 August 2018 12:40:07 UTC+2, David Ostrovsky wrote:
You missed:

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

I'd like to add that one should not run this in a Gerrit site directory¹, but instead on your workstation or similar. Then transfer the build (.jar) to your site in the plugins/ folder.

Humberto Israel Perez Rodriguez

unread,
Aug 10, 2018, 3:00:01 PM8/10/18
to Repo and Gerrit Discussion
I read the following documentation https://github.com/GerritCodeReview/gerrit/blob/master/README.md, however I still have issues building Gerrit tree

Please could you see the following bazel command output https://bugs.chromium.org/p/gerrit/issues/attachmentText?aid=352855

The things that I've tried

1. Change to another commit unsuccessfully
2. remove manually every time that the command output shonw me a package in Gerrit tree, e.g : ./lib/js/bower_components.bz, the thing is that every time after run the command it shows me a different one.


even with that I tried to build non-core plugins and the only ones that I've build successfully are:

https://gerrit-review.googlesource.com/admin/repos/plugins%2Favatars-gravatar
https://gerrit-review.googlesource.com/admin/repos/plugins%2Fdelete-project
https://gerrit-review.googlesource.com/admin/repos/plugins%2Fegit
https://gerrit-review.googlesource.com/admin/repos/plugins%2Fmotd
https://gerrit-review.googlesource.com/admin/repos/plugins%2Fmenuextender 

luke....@hpe.com

unread,
Aug 10, 2018, 3:20:18 PM8/10/18
to Repo and Gerrit Discussion
Are you building behind a proxy? I've found that when building Gerrit (or plugins) using bazel, I need to change my https proxy environment variable a bit:

echo $HTTPS_PROXY
https
://...
echo $HTTP_PROXY
http
://...
export HTTPS_PROXY=$HTTP_PROXY

I get the same "no such package '@iron-form-element-behavior//'" error when building Gerrit
with my HTTPS_PROXY set to https://, but when I change it to http:// it magically is able to find dependencies.

I don't entirely remember why that fixed it for me (lots of googling was involved), but it's worth a try if you're working behind a proxy.

-Luke

Matthias Sohn

unread,
Aug 10, 2018, 5:54:34 PM8/10/18
to luke....@hpe.com, Repo and Gerrit Discussion
I can successfully build current vanilla gerrit master with bazel

-Matthias
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Ostrovsky

unread,
Aug 11, 2018, 8:33:49 AM8/11/18
to Repo and Gerrit Discussion

On Friday, August 10, 2018 at 9:00:01 PM UTC+2, Humberto Israel Perez Rodriguez wrote:
I read the following documentation https://github.com/GerritCodeReview/gerrit/blob/master/README.md, however I still have issues building Gerrit tree

That's not enough, as this document doesn't tell you what
pre-requisites are required to build Gerrit core and plugins.

You have to follow this document: [1], that references yet
another document: [2] with more requirements, related to
new and shiny Gerrit UI.


Reply all
Reply to author
Forward
0 new messages