system-config/playbooks/zuul/gerrit/run.yaml
Clark Boylan 469153d820 Use patch instead of sed to update Gerrit's x/ route
We modify the x/ route to ensure we can serve git repos from x/.
Previously we had been using sed which is likely to be much more fragile
than patch. Patch will detect conflicts and other errors which would be
good for us to find out about early.

Change-Id: Ic324c7777e7851a6150e4415338c4628ac710970
2021-01-28 08:51:12 -08:00

58 lines
2.1 KiB
YAML

- hosts: all
tasks:
- name: Patch Gerrit's webapp routes to not shadow x/
shell: |
set -ex
GERRIT_BASE=/home/zuul/src/gerrit.googlesource.com/gerrit
SYSTEM_CONFIG_BASE=/home/zuul/src/opendev.org/opendev/system-config
# Disable the x/ redirection since we have x/ projects
patch $GERRIT_BASE/java/com/google/gerrit/httpd/raw/StaticModule.java \
$SYSTEM_CONFIG_BASE/docker/gerrit/patches/serve-x-normally.patch
- name: Build gerrit
include_role:
name: bazelisk-build
vars:
zuul_work_dir: /home/zuul/src/gerrit.googlesource.com/gerrit
# NOTE(ianw): There doesn't seem to be a way to integrate
# polygerrit/javascript plugins into the standard "release"
# target; we add plugins as separate targets here
bazelisk_targets:
- release
- plugins/zuul-results-summary:zuul-results-summary
# 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
dest: /home/zuul/src/gerrit.googlesource.com/gerrit/opendevtheme.html
- name: Build docker image
include_role:
name: build-docker-image
- hosts: localhost
roles:
- pause-buildset-registry