Merge "gerrit: get files from bazel build dir"

This commit is contained in:
Zuul 2021-01-19 05:29:38 +00:00 committed by Gerrit Code Review
commit 0a0e73f309
3 changed files with 28 additions and 13 deletions

View File

@ -17,15 +17,10 @@
FROM docker.io/opendevorg/gerrit-base as gerrit
COPY release.war /var/gerrit/bin/gerrit.war
COPY bazel-bin/release.war /var/gerrit/bin/gerrit.war
# Install plugins
RUN mkdir /var/gerrit/plugins && \
unzip -jo /var/gerrit/bin/gerrit.war WEB-INF/plugins/* -d /var/gerrit/plugins
COPY opendevtheme.html /var/gerrit/plugins/opendevtheme.html
FROM gerrit as gerrit-2
# Only Gerrit 2.14, 2.15, and 2.16 need this COPY
COPY javamelody-deps_deploy.jar /var/gerrit/lib/javamelody-deps_deploy.jar

View File

@ -12,6 +12,28 @@
vars:
zuul_work_dir: /home/zuul/src/gerrit.googlesource.com/gerrit
# Bazel makes "convenience symlinks" [1] starting with bazel-* to
# the actual build output. The problem is that we want to use the
# source tree as the context/build dir for our Docker container,
# and Docker refuses to follow symlinks for COPY commands; i.e. we
# can't copy stuff from the build output into the container.
# Therefore break the bazel-bin link and move to the top level so
# we can copy the built bits (jars, plugins, etc) into the
# container easily.
#
# [1] https://docs.bazel.build/versions/master/user-manual.html
- name: Make bazel-bin docker friendly
shell:
cmd: |
if [ ! -L bazel-bin ]; then
echo "bazel-bin not a symlink?"
exit 1
fi
target=$(readlink bazel-bin)
rm bazel-bin
mv $target bazel-bin
chdir: /home/zuul/src/gerrit.googlesource.com/gerrit
- name: Install OpenDev theme plugin
copy:
src: opendevtheme.html

View File

@ -3,13 +3,11 @@
set -x
java -fullversion
{{ bazelisk_executable }} version
{{ 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
fi
# release.war is a symlink. We want an actual file so that docker copy works right.
cp bazel-bin/release.war release.war
{{ bazelisk_executable }} \
build \
--spawn_strategy=standalone \
--genrule_strategy=standalone \
{{ bazelisk_targets|join(' ') }}
args:
executable: /bin/bash
chdir: "{{ zuul_work_dir }}"