bazelisk-build: specify targets as list

Specify bazelisk_targets as a list, and join the targets as
space-separated in the build command.  This is used in the follow-on
Ie0a165cc6ffc765c03457691901a1dd41ce99d5a.

While we are here, remove the build-gerrit.sh script that isn't used
any more, along with the step that installs it.

Also, refactor the tasks to use include_role (this is also used in the
follow on).

Change-Id: I4f3908e75cbbb7673135a2717f9e51f099a4860e
This commit is contained in:
Ian Wienand 2020-12-16 16:46:54 +11:00 committed by Clark Boylan
parent 1858f15a8a
commit e80893eb3d
6 changed files with 12 additions and 41 deletions

View File

@ -1,18 +0,0 @@
#!/bin/bash
# Note this script doesn't seem to be used by the image builds.
# The system-config/roles/bazelisk-build role seems to be used instead.
set +x
for attempt in seq 1 3 ; do
bazel build plugins/javamelody:javamelody-deps_deploy.jar 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

View File

@ -69,8 +69,3 @@
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

View File

@ -6,21 +6,20 @@
# Disable the x/ redirection since we have x/ projects
sed -i -e 's|"/x/\*"\,$|//"/x/*",|g' java/com/google/gerrit/httpd/raw/StaticModule.java
- hosts: all
roles:
- role: bazelisk-build
zuul_work_dir: /home/zuul/src/gerrit.googlesource.com/gerrit
- name: Run bazelisk build
include_role:
name: bazelisk-build
vars:
zuul_work_dir: /home/zuul/src/gerrit.googlesource.com/gerrit
- hosts: all
tasks:
- name: Install OpenDev theme plugin
copy:
src: opendevtheme.html
dest: /home/zuul/src/gerrit.googlesource.com/gerrit/opendevtheme.html
- hosts: all
roles:
- build-docker-image
- name: Build docker image
include_role:
name: build-docker-image
- hosts: localhost
roles:

View File

@ -5,16 +5,10 @@ Runs bazelisk build with the specified targets.
**Role Variables**
.. zuul:rolevar:: bazelisk_targets
:default: "release"
:default: ["release"]
The bazelisk targets to build.
.. zuul:rolevar:: bazelisk_test_targets
:default: ""
The bazelisk targets to test. ``bazelisk test`` will only be run
if this value is not the empty string.
.. zuul:rolevar:: bazelisk_executable
:default: bazelisk

View File

@ -1,3 +1,4 @@
bazelisk_targets: release
bazelisk_targets:
- release
bazelisk_executable: bazelisk
zuul_work_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir}}"

View File

@ -3,7 +3,7 @@
set -x
java -fullversion
{{ bazelisk_executable }} version
{{ bazelisk_executable }} build --spawn_strategy=standalone --genrule_strategy=standalone {{ bazelisk_targets }}
{{ bazelisk_executable }} build --spawn_strategy=standalone --genrule_strategy=standalone {{ bazelisk_targets|join(' ') }}
if [[ -f bazel-bin/plugins/javamelody/javamelody-deps_deploy.jar ]] ; then
# versions 2.14, 2.15, and 2.16 generate this file
cp bazel-bin/plugins/javamelody/javamelody-deps_deploy.jar javamelody-deps_deploy.jar