From 469153d82031c70b614d24d7da04966018ca6fa5 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 28 Jan 2021 08:51:12 -0800 Subject: [PATCH] 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 --- docker/gerrit/patches/serve-x-normally.patch | 13 +++++++++++++ playbooks/zuul/gerrit/run.yaml | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 docker/gerrit/patches/serve-x-normally.patch diff --git a/docker/gerrit/patches/serve-x-normally.patch b/docker/gerrit/patches/serve-x-normally.patch new file mode 100644 index 0000000000..c7c0d6c336 --- /dev/null +++ b/docker/gerrit/patches/serve-x-normally.patch @@ -0,0 +1,13 @@ +diff --git a/java/com/google/gerrit/httpd/raw/StaticModule.java b/java/com/google/gerrit/httpd/raw/StaticModule.java +index 414a120194..9d59535a66 100644 +--- a/java/com/google/gerrit/httpd/raw/StaticModule.java ++++ b/java/com/google/gerrit/httpd/raw/StaticModule.java +@@ -71,7 +71,7 @@ public class StaticModule extends ServletModule { + "/c/*", + "/p/*", + "/q/*", +- "/x/*", ++ //"/x/*", + "/admin/*", + "/dashboard/*", + "/groups/self", diff --git a/playbooks/zuul/gerrit/run.yaml b/playbooks/zuul/gerrit/run.yaml index db6d99e32b..cccd2466ac 100644 --- a/playbooks/zuul/gerrit/run.yaml +++ b/playbooks/zuul/gerrit/run.yaml @@ -2,9 +2,12 @@ tasks: - name: Patch Gerrit's webapp routes to not shadow x/ shell: | - cd /home/zuul/src/gerrit.googlesource.com/gerrit + 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 - sed -i -e 's|"/x/\*"\,$|//"/x/*",|g' java/com/google/gerrit/httpd/raw/StaticModule.java + 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: