Page MenuHomePhabricator

Convert gerrit-theme to Polymer 3
Closed, ResolvedPublic


Gerrit requires plugins to be converted from HTML to Javascript. A first attempt was made with but got reverted. We have since upgraded to Gerrit 3.3 and the gerrit-theme.js shipped by that reverted commit is still on the server and takes precedence over the gerrit-theme.html. So essentially the conversion is done.

I independently gave it a try this morning on my local machine with . In the web ui it showed:

Plugin install error: Unrecognized plugin path /static/gerrit-theme.html from /static/gerrit-theme.html

The file that fails to load comes from Puppet: modules/gerrit/files/homedir/review_site/static/gerrit-theme.html which I guess is an HTML plugin for which support is removed in 3.4 @Paladox you told me about it, have you ever made a patch to migrate or do you have any guidance as to what needs to be done? :]

HTML plugins should be migrated to JavaScript plugins. This also implies Polymer 2 plugins wouldn’t work any more. See also this announcement for more details.

From the javascript console:

TypeError: URL constructor: /static/gerrit-theme.html is not a valid URL.
Plugin loaded separately: /static/gerrit-theme.html
Runtime info
Gerrit UI (PolyGerrit)
Gerrit Server Version: f712a44

Plugin codemirror-editor installed. gr-app.js:317:14209
Plugin delete-project installed. gr-app.js:317:14209
Plugin lfs installed. gr-app.js:317:14209
Plugin reviewers installed. gr-app.js:317:14209
Plugin zuul installed.

Related Objects

Event Timeline

Change 756111 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/puppet@production] gerrit: port our theme to JavaScript got reverted however on the server the .js file is still present:

md5sum /var/lib/gerrit2/review_site/static/gerrit-theme*
a0b45d4f929a36b010f89b4755e95962  /var/lib/gerrit2/review_site/static/gerrit-theme.html
3f6f78618881137e26eb730d6e8fb050  /var/lib/gerrit2/review_site/static/gerrit-theme.js

Checking a web request, I have confirmed the .js file is used rather than the .html file. So essentially the conversion has already happened as part of upgrading from Gerrit 3.2 to 3.3. The upstream change is: which made the js file to take precedence and has been released with 3.3.0:

   private String getDefaultTheme() {
     if (config.getString("theme", null, "enableDefault") == null) {
       // If not explicitly enabled or disabled, check for the existence of the theme file.
-      return Files.exists(sitePaths.site_theme) ? DEFAULT_THEME : null;
+      return Files.exists(sitePaths.site_theme_js)
+          ? DEFAULT_THEME_JS
+          : Files.exists(sitePaths.site_theme) ? DEFAULT_THEME : null;

The conversion has been done by @Paladox and is already deployed (albeit by mistake). The Puppet change I have send restore the patch by Paladox with an extra bit to ensure gerrit-theme.html is purged from the servers.

Change 756111 merged by Jbond:

[operations/puppet@production] gerrit: Convert gerrit-theme to Polymer 3

Change 832343 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/puppet@production] gerrit: gerrit-theme.html is long gone

Change 832343 merged by Dzahn:

[operations/puppet@production] gerrit: gerrit-theme.html is long gone