|author||Gavin Mak <firstname.lastname@example.org>||Tue Feb 22 20:05:41 2022|
|committer||LUCI CQ <email@example.com>||Tue Feb 22 20:05:41 2022|
Add tree status explainer Newer devs may not be familiar with tree statuses. This CL adds a link to documentation. Bug: 664559 Change-Id: I6b39e2ec20efaec8458449f0c7f392c6165a82e8 Reviewed-on: https://chromium-review.googlesource.com/c/infra/gerrit-plugins/chumpdetector/+/3440727 Reviewed-by: Aravind Vasudevan <firstname.lastname@example.org> Reviewed-by: Josip Sokcevic <email@example.com> Commit-Queue: Gavin Mak <firstname.lastname@example.org>
This plugin will allow developers to see the current status on their CLs. Status will be pulled from a configurable location. The Chromium project has many status sites such as:
The plugin will show users the status and will warn them in certain situations if they attempt to undertake actions that are contrary to the tree status.
The plugin does not provide enforcement - that is provided by other systems.
Before this plugin will work you'll need to configure it. You can do that by adding a new file to
refs/meta/config for a Gerrit project. The configuration file should be called
chumpdetector.config and should be of the form:
[project "some-interesting-project"] loginURL = https://login.appspot.com/?next=chromium-status viewURL = https://chromium-status.appspot.com/ statusURL = https://chromium-status.appspot.com/current?format=json withCredentials = false enforceCommitQueue = false disabledBranchPattern = ^(?:refs/meta/config|refs/heads/.*)$
The project name doesn‘t matter, it can be anything you’d like
withCredentials is true and a request for status fails, the system assumes that a login is required and has not occurred. In that case the status message will change to “Login required. Click here to login.” The text will be a link that points to the value of
loginURL is not set then the message will just be
RequestError: Login required. with no link.
This should be the URL to your status app. This is used to provide a link that users can click on to take them to a new page that shows the full status.
This should be the URL to get a JSON blob of the current status. Usually this will be related to the
viewURL value. This is the URL that will be queried via XHR periodically while the user is on the page to update the tree status.
withCredentials parameter. You can read about it at https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
When true, this will show a modal warning to users if they try to submit the CL directly and warn them to use the CQ. This is Chromium concept, unless you have a Chromium-like CQ system. Just leave as false if you don't understand what any of those things mean.
CLs on branches that match this pattern will have the plugin disabled. This means they won‘t see tree status and tree status won’t effect the CL in any way.
This setting causes the plugin to request a URL via an an image that is dynamically added to the page before making any other fetch requests. This is useful in situations where the request to the status URL will fail without certain cookies being set for the status request domain. By using an image tag the browser will correctly follow any redirects that a login process may require in order to establish the session cookies.
Most installs will not need this configuration and can ignore it. For certain sites this may allow them to get security cookies before attempting status requests which will fail without the cookies.
For running TypeScript unit tests execute:
bazel test --test_output=all //plugins/chumpdetector/web:karma_test
For checking or fixing eslint formatter problems run:
bazel test //plugins/chumpdetector/web:lint_test bazel run //plugins/chumpdetector/web:lint_bin -- \ --fix "$(pwd)/plugins/chumpdetector/web"
bazel build //plugins/chumpdetector/web:chumpdetector cp -f bazel-bin/plugins/chumpdetector/web/chumpdetector.js plugins/
Start polygerit-ui server:
and let the Dev Helper redirect from