From 738b4ba7395cc27332dbd35141be0d887d64d231 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 15 Dec 2020 16:33:24 +1100 Subject: [PATCH] gerrit: Install zuul-summary-results plugin This installs the zuul-summary-results plugin into our gerrit container. testinfra is updated to take a screenshot of the plugin in action. Change-Id: Ie0a165cc6ffc765c03457691901a1dd41ce99d5a --- docker/gerrit/bazel/Dockerfile | 3 +-- playbooks/zuul/gerrit/repos.yaml | 1 + playbooks/zuul/gerrit/run.yaml | 8 +++++++- testinfra/test_gerrit.py | 13 ++++++++++--- zuul.d/docker-images/gerrit.yaml | 4 ++++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/docker/gerrit/bazel/Dockerfile b/docker/gerrit/bazel/Dockerfile index 67bb3e9361..4009f56b03 100644 --- a/docker/gerrit/bazel/Dockerfile +++ b/docker/gerrit/bazel/Dockerfile @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This comment is here to be edited to force rebuilds. Please rebuild. - FROM docker.io/opendevorg/gerrit-base as gerrit COPY bazel-bin/release.war /var/gerrit/bin/gerrit.war @@ -24,3 +22,4 @@ 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 +COPY bazel-bin/plugins/zuul-results-summary/zuul-results-summary.js /var/gerrit/plugins/zuul-results-summary.js diff --git a/playbooks/zuul/gerrit/repos.yaml b/playbooks/zuul/gerrit/repos.yaml index 480f8f027b..18f9b81812 100644 --- a/playbooks/zuul/gerrit/repos.yaml +++ b/playbooks/zuul/gerrit/repos.yaml @@ -34,6 +34,7 @@ - reviewnotes - singleusergroup - webhooks + - zuul-results-summary # Some submodules don't have appropriate refs to checkout for specific # gerrit branches. We address that by checking them out explicitly in diff --git a/playbooks/zuul/gerrit/run.yaml b/playbooks/zuul/gerrit/run.yaml index 56c7b3dce7..db6d99e32b 100644 --- a/playbooks/zuul/gerrit/run.yaml +++ b/playbooks/zuul/gerrit/run.yaml @@ -6,11 +6,17 @@ # Disable the x/ redirection since we have x/ projects sed -i -e 's|"/x/\*"\,$|//"/x/*",|g' java/com/google/gerrit/httpd/raw/StaticModule.java - - name: Run bazelisk build + - 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 diff --git a/testinfra/test_gerrit.py b/testinfra/test_gerrit.py index 12a7015a47..58bb144926 100644 --- a/testinfra/test_gerrit.py +++ b/testinfra/test_gerrit.py @@ -26,7 +26,6 @@ def test_gerrit_listening(host): gerrit_web = host.socket("tcp://:::8081") assert gerrit_web.is_listening - def test_gerrit_screenshot(host): driver = webdriver.Remote( command_executor='http://%s:4444/wd/hub' % (host.backend.get_hostname()), @@ -39,8 +38,16 @@ def test_gerrit_screenshot(host): driver.save_screenshot("/var/log/screenshots/gerrit-main-page.png") driver.get("http://localhost:8081/c/test-project/+/1") - WebDriverWait(driver, 30).until(lambda driver: driver.execute_script( - 'return document.readyState') == 'complete') + time.sleep(5) + driver.execute_script( + "document.querySelector('gr-app').shadowRoot" + ".querySelector('gr-app-element').shadowRoot" + ".querySelector('main')" + ".querySelector('gr-change-view').shadowRoot" + ".querySelector('paper-tab[data-name=\"change-view-tab-header-zuul-results-summary\"]')" + ".click()" + ) + time.sleep(5) driver.save_screenshot("/var/log/screenshots/gerrit-change-page.png") except TimeoutException as e: raise e diff --git a/zuul.d/docker-images/gerrit.yaml b/zuul.d/docker-images/gerrit.yaml index 30d8983c28..205ef77107 100644 --- a/zuul.d/docker-images/gerrit.yaml +++ b/zuul.d/docker-images/gerrit.yaml @@ -83,6 +83,8 @@ override-checkout: v3.2.3 - name: gerrit.googlesource.com/plugins/webhooks override-checkout: v3.2.3 + - name: gerrit.googlesource.com/plugins/zuul-results-summary + override-checkout: main # Non plugin submodules - name: gerrit.googlesource.com/jgit override-checkout: master @@ -156,6 +158,8 @@ - gerrit.googlesource.com/plugins/reviewnotes - gerrit.googlesource.com/plugins/singleusergroup - gerrit.googlesource.com/plugins/webhooks + - name: gerrit.googlesource.com/plugins/zuul-results-summary + override-checkout: main - gerrit.googlesource.com/polymer-bridges vars: &gerrit_vars_master zuul_work_dir: src/opendev.org/opendev/system-config