Hi,

I've been playing around with gerrit over the weekend, updated the old dashboard [1] we had, and moved it into gerrit [2].

In case someone is interested, here is the process to set it up. (Which might not be the best way, or even the correct way - gerrit has poor documentation, so I mostly figured it out by trial and error. Still, it seems to work.)

The dashboard configuration files must reside in a /refs/meta/dashboards/<dashboard group name> branch - that much is documented clearly. [3] There is no way in to create an empty branch on the admin interface, though, and git review refuses to work without an existing branch. One can create a branch by simply pushing to the remote (it doesn't even require push rights - that is probably a bug), and the dashboards will work, but the branch ends up broken somehow, and gerrit will be unable to push further changes into it.

The solution is to create a parentless commit locally, then push it to refs/heads/tmp on the remote. This won't actually do anything, but gerrit will not reject the push, which means it will store the commit object. After this, one can create a branch through the admin interface [4], using this commit id. The branch will not be visible in the branch listing, for no reason whatsoever (it is visible when created by pushing directly, and refs/meta/config is also visible), but it will be there, and can be targeted by git review.

So the whole process looks like this:

git checkout --orphan custom-dashboards
vim my-dashboard
git commit my-dashboard
git push gerrit custom-dashboards:refs/heads/tmp
<go to the branch menu in gerrit project admin, add  branch /refs/meta/dashboards/custom with id of the above commit>

The only obstacle left is that Jenkins will freak out from changesets in this branch, and report a merge error. I haven't figured out a way to fix that, but the workaround described on mediawiki.org [5] works: remove the review made by jenkinsbot, set +2/+2, click "Publish and submit".



[1] https://www.mediawiki.org/wiki/Multimedia/CR_Dashboard
[2] https://gerrit.wikimedia.org/r/#/admin/projects/mediawiki/extensions/MultimediaViewer,dashboards
[3] https://gerrit-review.googlesource.com/Documentation/user-dashboards.html#project-dashboards
[4] https://gerrit.wikimedia.org/r/#/admin/projects/mediawiki/extensions/MultimediaViewer,branches
[5] https://www.mediawiki.org/wiki/Gerrit/Advanced_usage#You_need_to_override_Jenkins