diff --git a/docker/gerrit/bazel/Dockerfile b/docker/gerrit/bazel/Dockerfile index 0518d02dff..4c0098936e 100644 --- a/docker/gerrit/bazel/Dockerfile +++ b/docker/gerrit/bazel/Dockerfile @@ -36,18 +36,7 @@ USER builder COPY . /usr/src ARG BAZEL_OPTS -RUN cd /usr/src \ - && bazel build release \ - --local_ram_resources=3072 \ - --local_cpu_resources=1 \ - --host_force_python=PY3 \ - --incompatible_string_join_requires_strings=false \ - --define=ABSOLUTE_JAVABASE=/usr/lib/jvm/java-8-openjdk-amd64 \ - --javabase=@bazel_tools//tools/jdk:absolute_javabase \ - --host_javabase=@bazel_tools//tools/jdk:absolute_javabase \ - --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \ - --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \ - ${BAZEL_OPTS} +RUN cd /usr/src && bash build-gerrit.sh FROM openjdk:8 diff --git a/docker/gerrit/bazel/build-gerrit.sh b/docker/gerrit/bazel/build-gerrit.sh new file mode 100755 index 0000000000..a4c268eee0 --- /dev/null +++ b/docker/gerrit/bazel/build-gerrit.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set +x + +for attempt in seq 1 3 ; do + bazel build release \ + --define=ABSOLUTE_JAVABASE=/usr/lib/jvm/java-8-openjdk-amd64 \ + --javabase=@bazel_tools//tools/jdk:absolute_javabase \ + --host_javabase=@bazel_tools//tools/jdk:absolute_javabase \ + --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \ + --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \ + $@ + result=$? +done +exit $result diff --git a/playbooks/zuul/gerrit/repos.yaml b/playbooks/zuul/gerrit/repos.yaml index df376b0aa5..d8b1970314 100644 --- a/playbooks/zuul/gerrit/repos.yaml +++ b/playbooks/zuul/gerrit/repos.yaml @@ -47,3 +47,8 @@ force: yes src: javamelody/external_plugin_deps.bzl path: /home/zuul/src/gerrit.googlesource.com/gerrit/plugins/external_plugin_deps.bzl + + - name: Move build script into main gerrit source dir + command: "mv docker/gerrit/bazel/build-gerrit.sh /home/zuul/src/gerrit.googlesource.com/gerrit" + args: + chdir: /home/zuul/src/opendev.org/opendev/system-config