Gerrit bazel build is failing

992 views
Skip to first unread message

Rajesh M

unread,
Jul 3, 2019, 9:34:10 AM7/3/19
to Repo and Gerrit Discussion
Hi,

I am trying to build gerrit, but it's failing with all the versions.

[root@test-gerrit gerrit_2]# git branch
* (HEAD detached at v2.16.9)
  master

[root@test-gerrit gerrit_2]# bazel --version
bazel
0.27.0
[root@test-gerrit gerrit_2]#

[root@test-gerrit gerrit_2]# npm list
/opt/gerr_dev
├── @webcomponents/webcomponentsjs@2.2.10
├── bower@1.8.8
├─┬ node@8.16.0
└── node-bin-setup@1.0.6
├── nodejs@0.0.0
└── webcomponents.js@0.7.24


[root@test-gerrit gerrit_2]# bazel build release
INFO
: Invocation ID: 1625606d-ac34-441c-b900-21507e3e04c2
INFO
: Call stack for the definition of repository 'webcomponentsjs' which is a bower_archive (rule definition at /opt/gerr_dev/gerrit_2/tools/bzl/js.bzl:122:17):
 
- /opt/gerr_dev/gerrit_2/lib/js/bower_archives.bzl:166:5
 
- /opt/gerr_dev/gerrit_2/WORKSPACE:1362:1
ERROR
: An error occurred during the fetch of repository 'webcomponentsjs':
   
Traceback (most recent call last):
       
File "/opt/gerr_dev/gerrit_2/tools/bzl/js.bzl", line 84
                fail
(("failed %s: %s" % (" ".join(cmd...)))
       
File "/opt/gerr_dev/gerrit_2/tools/bzl/js.bzl", line 84, in fail
               
" ".join(cmd)
sequence element must be a
string (got 'path'). See https://github.com/bazelbuild/bazel/issues/7802 for information about --incompatible_string_join_requires_strings.
INFO
: Call stack for the definition of repository 'remote_java_tools_linux' which is a http_archive (rule definition at /root/.cache/bazel/_bazel_root/d2f2485e337bd1b3ae7ffed8a7c0bf78/external/bazel_tools/tools/build_defs/repo/http.bzl:237:16):
 
- /DEFAULT.WORKSPACE.SUFFIX:229:1
INFO: Call stack for the definition of repository 'remotejdk11_linux' which is a http_archive (rule definition at /
root/.cache/bazel/_bazel_root/d2f2485e337bd1b3ae7ffed8a7c0bf78/external/bazel_tools/tools/build_defs/repo/http.bzl:237:16):
 
- /DEFAULT.WORKSPACE.SUFFIX:199:1
ERROR: /
opt/gerr_dev/gerrit_2/polygerrit-ui/app/BUILD:7:1: no such package '@webcomponentsjs//': Traceback (most recent call last):
       
File "/opt/gerr_dev/gerrit_2/tools/bzl/js.bzl", line 84
                fail
(("failed %s: %s" % (" ".join(cmd...)))
       
File "/opt/gerr_dev/gerrit_2/tools/bzl/js.bzl", line 84, in fail
               
" ".join(cmd)
sequence element must be a
string (got 'path'). See https://github.com/bazelbuild/bazel/issues/7802 for information about --incompatible_string_join_requires_strings. and referenced by '//polygerrit-ui/app:polygerrit_ui'
ERROR
: Analysis of target '//:release' failed; build aborted: no such package '@webcomponentsjs//': Traceback (most recent call last):
       
File "/opt/gerr_dev/gerrit_2/tools/bzl/js.bzl", line 84
                fail
(("failed %s: %s" % (" ".join(cmd...)))
       
File "/opt/gerr_dev/gerrit_2/tools/bzl/js.bzl", line 84, in fail
               
" ".join(cmd)
sequence element must be a
string (got 'path'). See https://github.com/bazelbuild/bazel/issues/7802 for information about --incompatible_string_join_requires_strings.
INFO
: Elapsed time: 1.394s
INFO
: 0 processes.
FAILED
: Build did NOT complete successfully (41 packages loaded, 264 targets configured)
    currently loading
: java/com/google/gerrit/pgm/util
   
Fetching @local_config_cc; fetching
[root@test-gerrit gerrit_2]#


Could you please help to resolve this build issue ?

Thanks and Regards,
Rajesh M

Thomas Dräbing

unread,
Jul 3, 2019, 9:56:46 AM7/3/19
to Rajesh M, Repo and Gerrit Discussion
Hi Rajesh,

this is due to a breaking change in bazel 0.27.0 [1]. The bazel-version suggested to be used for building Gerrit 2.16.9 is 0.26.1. Have you tried to use bazel 0.26.1?

FYI, since recently, the bazelversion suggested for the respective Gerrit version can be found in the `.bazelversion`-file in the project's root. You can also use bazelisk [2] to automatically choose the bazel-version depending on this file.

HTH,
Thomas


--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/57a9b59c-59f0-44f6-b6cd-ac2f501eec20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rajesh M

unread,
Jul 3, 2019, 10:03:50 AM7/3/19
to Repo and Gerrit Discussion
Hi,

Thank you very much for the information Thomas. I haven't tried with the old version of bazel. Let me check with 0.26.1 which mentioned in the .bazelversion file.

Thanks and Regards,
Rajesh M


On Wednesday, 3 July 2019 15:56:46 UTC+2, Thomas Dräbing wrote:
Hi Rajesh,

this is due to a breaking change in bazel 0.27.0 [1]. The bazel-version suggested to be used for building Gerrit 2.16.9 is 0.26.1. Have you tried to use bazel 0.26.1?

FYI, since recently, the bazelversion suggested for the respective Gerrit version can be found in the `.bazelversion`-file in the project's root. You can also use bazelisk [2] to automatically choose the bazel-version depending on this file.

HTH,
Thomas


To unsubscribe, email repo-d...@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-d...@googlegroups.com.

David Pursehouse

unread,
Jul 4, 2019, 12:22:45 AM7/4/19
to Rajesh M, Repo and Gerrit Discussion
Other than using bazel 0.26 as recommended by Thomas, can you try to cherry-pick this and see if it fixes it for 0.27?


I'm using 0.27 locally and the build is working, but I already had all the artifacts downloaded and I'm assuming this error is occuring on a completely clean build where it's attempting to download.

 

Thanks and Regards,
Rajesh M

--
--
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.

Rajesh M

unread,
Jul 4, 2019, 5:00:11 AM7/4/19
to Repo and Gerrit Discussion
Thanks David. This fetch did the job well with bazel 0.27 version and "bazel build gerrit" passed successfully.

But, still there are failures with the plugins cook individually or through "bazel build release". I am using java 1.8 and the errors are below,

[gerrit@test-gerrit gerrit_1]$ java -version
openjdk version
"1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
[gerrit@test-gerrit gerrit_1]$

[gerrit@test-gerrit gerrit_1]$ bazel build release
INFO: Invocation ID: 1c6f2216-a519-4143-ac0f-68a9e3b39398
INFO: Analyzed target //:release (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
INFO: From Building java/com/google/gerrit/lucene/liblucene.jar (12 source files):
java/com/google/gerrit/lucene/WrappableSearcherManager.java:191: warning: [ReferenceEquality] Comparison using reference equality instead of value equality
        if (unwrapped == reader) {
                      ^
  Did you mean 'if (Objects.equals(unwrapped, reader)) {' or 'if (unwrapped.equals(reader)) {'?
java/com/google/gerrit/lucene/WrappableSearcherManager.java:202: warning: [ReferenceEquality] Comparison using reference equality instead of value equality
      if (unwrapped != reader) {
                    ^
  Did you mean 'if (!Objects.equals(unwrapped, reader)) {' or 'if (!unwrapped.equals(reader)) {'?
INFO: From Building java/com/google/gerrit/sshd/libsshd.jar (100 source files) and running annotation processors (AutoAnnotationProcessor, AutoValueProcessor):
java/com/google/gerrit/sshd/commands/ApproveOption.java:32: warning: [BadAnnotationImplementation] Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.
final class ApproveOption implements Option, Setter<Short> {
      ^
java/com/google/gerrit/sshd/commands/ApproveOption.java:35: warning: [ImmutableAnnotationChecker] annotations should be immutable: 'ApproveOption' has field 'type' of type 'com.google.gerrit.common.data.LabelType', the declaration of type 'com.google.gerrit.common.data.LabelType' is not annotated with @com.google.errorprone.annotations.Immutable
  private final LabelType type;
                          ^
java/com/google/gerrit/sshd/commands/ApproveOption.java:37: warning: [ImmutableAnnotationChecker] annotations should be immutable: 'ApproveOption' has non-final field 'value'
  private Short value;
                ^
  Did you mean 'private final Short value;'?
java/com/google/gerrit/sshd/commands/StreamEvents.java:284: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.
      synchronized (stdout) {
                   ^
java/com/google/gerrit/sshd/commands/StreamEvents.java:291: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.
    synchronized (stdout) {
                 ^
java/com/google/gerrit/sshd/commands/UploadArchive.java:142: warning: [ReferenceEquality] Comparison using reference equality instead of value equality
      if (s == PacketLineIn.END) {
            ^
  Did you mean 'if (Objects.equals(s, PacketLineIn.END)) {' or 'if (s.equals(PacketLineIn.END)) {'?
java/com/google/gerrit/sshd/commands/UploadArchive.java:142: warning: [StringEquality] String comparison using reference equality instead of value equality
      if (s == PacketLineIn.END) {
            ^
  Did you mean 'if (Objects.equals(s, PacketLineIn.END)) {' or 'if (s.equals(PacketLineIn.END)) {'?
INFO: From Building java/com/google/gerrit/httpd/libhttpd-class.jar (113 source files) and running annotation processors (AutoAnnotationProcessor, AutoValueProcessor):
java/com/google/gerrit/httpd/HttpServletResponseRecorder.java:74: warning: [MissingOverride] getStatus overrides method in HttpServletResponseWrapper; expected @Override
  public int getStatus() {
             ^
  Did you mean '@Override @SuppressWarnings("all")'?
java/com/google/gerrit/httpd/rpc/AuditedHttpServletResponse.java:29: warning: [MissingOverride] getStatus overrides method in HttpServletResponseWrapper; expected @Override
  public int getStatus() {
             ^
  Did you mean '@Override @SuppressWarnings("all")'?
ERROR: /opt/gerr_dev/gerrit_4/plugins/hooks/BUILD:4:1: Building plugins/hooks/libhooks__plugin-class.jar (27 source files) and running annotation processors (AutoAnnotationProcessor, AutoValueProcessor) failed (Exit 1)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookMetrics.java:50: error: type Context does not take parameters
  public Timer1.Context<String> start(String name) {
                       ^
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/Submit.java:17: error: cannot find symbol
import com.google.gerrit.reviewdb.client.BranchNameKey;
                                        ^
  symbol:   class BranchNameKey
  location: package com.google.gerrit.reviewdb.client
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/Submit.java:44: error: cannot find symbol
      BranchNameKey destBranch,
      ^
  symbol:   class BranchNameKey
  location: class Submit
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookArgs.java:109: error: incompatible types: Object cannot be converted to String
              .orElse(""));
                     ^
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookArgs.java:108: error: cannot find symbol
                          Project.nameKey(change.project), Change.id(change._number)))
                                 ^
  symbol:   method nameKey(String)
  location: class Project
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookArgs.java:108: error: cannot find symbol
                          Project.nameKey(change.project), Change.id(change._number)))
                                                                 ^
  symbol:   method id(int)
  location: class Change
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookArgs.java:134: error: cannot find symbol
        "\"%s\"", identifiedUserFactory.create(Account.id(account._accountId)).getNameEmail());
                                                      ^
  symbol:   method id(Integer)
  location: class Account
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookMetrics.java:34: error: cannot find symbol
    Field<String> field = Field.ofString("hook").build();
                                                ^
  symbol:   method build()
  location: class Field<String>
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookTask.java:88: error: type Context does not take parameters
    try (Timer1.Context<String> timer = args.metrics.start(name)) {
                       ^
plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookTask.java:101: error: cannot find symbol
        try (Repository git = args.gitManager.openRepository(Project.nameKey(projectName))) {
                                                                    ^
  symbol:   method nameKey(String)
  location: class Project
Target //:release failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 59.846s, Critical Path: 36.18s
INFO: 37 processes: 23 processwrapper-sandbox, 14 worker.
FAILED: Build did NOT complete successfully
[gerrit@test-gerrit gerrit_1]$


Individual plugin cook post the development build(bazel build gerrit) success.

[gerrit@test-gerrit gerrit_1]$ bazel build plugins/hooks --verbose_failures
INFO
: Invocation ID: 6da73ed9-4b98-4ab3-8daa-f38da3b54211
INFO
: Analyzed target //plugins/hooks:hooks (0 packages loaded, 0 targets configured).
INFO
: Found 1 target...
ERROR
: /opt/gerr_dev/gerrit_1/plugins/hooks/BUILD:4:1: Building plugins/hooks/libhooks__plugin-class.jar (27 source files) and running annotation processors (AutoAnnotationProcessor, AutoValueProcessor) failed (Exit 1): java failed: error executing command
 
(cd /home_local/gerrit/.cache/bazel/_bazel_gerrit/8bf072abeeb630459cfd03daacc7e9cd/execroot/gerrit && \
 
exec env - \
    LC_CTYPE
=en_US.UTF-8 \
    PATH
=/opt/maven/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home_local/gerrit/bin:/usr/local/git/bin \
  external
/remotejdk11_linux/bin/java -XX:+UseParallelOldGC -XX:-CompactStrings '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--patch-module=java.compiler=external/remote_java_tools_linux/java_tools/java_compiler.jar' '--patch-module=jdk.compiler=external/remote_java_tools_linux/java_tools/jdk_compiler.jar' '--add-opens=java.base/java.nio=ALL-UNNAMED' '--add-opens=java.base/java.lang=ALL-UNNAMED' -jar external/remote_java_tools_linux/java_tools/JavaBuilder_deploy.jar @bazel-out/k8-fastbuild/bin/plugins/hooks/libhooks__plugin-class.jar-0.params @bazel-out/k8-fastbuild/bin/plugins/hooks/libhooks__plugin-class.jar-1.params)
Execution platform: @bazel_tools//platforms:host_platform
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookMetrics.java:50: error: type Context does not take parameters
 
public Timer1.Context<String> start(String name) {
                       
^
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/Submit.java:17: error: cannot find symbol
import com.google.gerrit.reviewdb.client.BranchNameKey;
                                       
^
  symbol
:   class BranchNameKey
  location
: package com.google.gerrit.reviewdb.client
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/Submit.java:44: error: cannot find symbol
     
BranchNameKey destBranch,
     
^
  symbol
:   class BranchNameKey
  location
: class Submit
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookArgs.java:109: error: incompatible types: Object cannot be converted to String
             
.orElse(""));
                     
^
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookArgs.java:108: error: cannot find symbol
                         
Project.nameKey(change.project), Change.id(change._number)))
                                 
^
  symbol
:   method nameKey(String)
  location
: class Project
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookArgs.java:108: error: cannot find symbol
                         
Project.nameKey(change.project), Change.id(change._number)))
                                                                 
^
  symbol
:   method id(int)
  location
: class Change
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookArgs.java:134: error: cannot find symbol
       
"\"%s\"", identifiedUserFactory.create(Account.id(account._accountId)).getNameEmail());
                                                     
^
  symbol
:   method id(Integer)
  location
: class Account
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookMetrics.java:34: error: cannot find symbol
   
Field<String> field = Field.ofString("hook").build();
                                               
^
  symbol
:   method build()
  location
: class Field<String>
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookTask.java:88: error: type Context does not take parameters
   
try (Timer1.Context<String> timer = args.metrics.start(name)) {
                       
^
plugins
/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookTask.java:101: error: cannot find symbol
       
try (Repository git = args.gitManager.openRepository(Project.nameKey(projectName))) {
                                                                   
^
  symbol
:   method nameKey(String)
  location
: class Project
Target //plugins/hooks:hooks failed to build
INFO
: Elapsed time: 0.939s, Critical Path: 0.64s

INFO
: 0 processes.
FAILED
: Build did NOT complete successfully
[gerrit@test-gerrit gerrit_1]$


Is this related to bazel as it is dependent with jdk 11 ?

=================================================================================================================================================================================================
 
Package                                                Arch                                 Version                                            Repository                                  Size
=================================================================================================================================================================================================
Installing:
 bazel                                                  x86_64                              
0.27.0-7.el7                                       vbatts-bazel                                25 M
Installing for dependencies:
 java
-11-openjdk                                        x86_64                               1:11.0.ea.28-7.el7                                 nsn                                        189 k
 java
-11-openjdk-devel                                  x86_64                               1:11.0.ea.28-7.el7                                 nsn                                        3.3 M
 java
-11-openjdk-headless                               x86_64                               1:11.0.ea.28-7.el7                                 nsn                                         38 M


Transaction Summary
=================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)


Total download size: 67 M
Installed size: 193 M
Is this ok [y/d/N]:



Thanks,
Rajesh M


On Thursday, 4 July 2019 06:22:45 UTC+2, David Pursehouse wrote:
To unsubscribe, email repo-d...@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-d...@googlegroups.com.

Thomas Dräbing

unread,
Jul 4, 2019, 5:21:31 AM7/4/19
to Rajesh M, Repo and Gerrit Discussion
Hi Rajesh,

for me the hooks-plugin builds without issues, but if I look at your logs, we do seem to have different versions of the plugin, e.g. in `plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookMetrics.java` line 50, I read `public Timer1.Context start(String name) {` instead of `public Timer1.Context<String> start(String name) {`. Did you update and reinitialize the submodules?

Best,
Thomas

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/5314e648-2209-4083-8a83-75a698b7ba7a%40googlegroups.com.

Rajesh M

unread,
Jul 4, 2019, 5:59:47 AM7/4/19
to Repo and Gerrit Discussion
Hi Thomas,

Yes, the hooks plugin alone didn't change to the correct version. Noticed the HEAD with the master branch. I have checked-out the tag which related to v2.16.9 and tried, then the build got succeeded.
Thank you Thomas and David for the guidance.

Best Regards,
Rajesh M


On Thursday, 4 July 2019 11:21:31 UTC+2, Thomas Dräbing wrote:
Hi Rajesh,

for me the hooks-plugin builds without issues, but if I look at your logs, we do seem to have different versions of the plugin, e.g. in `plugins/hooks/src/main/java/com/googlesource/gerrit/plugins/hooks/HookMetrics.java` line 50, I read `public Timer1.Context start(String name) {` instead of `public Timer1.Context<String> start(String name) {`. Did you update and reinitialize the submodules?

Best,
Thomas

Reply all
Reply to author
Forward
0 new messages