Include unsatisfied SRs into new patch set email when change becomes unsubmittable

When a change becomes unsubmittable users want to know which submit
requirements are no longer satisfied.

With this change we extend the email notification that is sent when
creating a new patch set to include the submit requirement that are
unsatisfied due to the creation of the new patch set (e.g. because an
approval got outdated and removed).

Extending the email notification that is sent when replying on a change
with the same information was already done by change Ic1ac9f02f.

To know whether the change got non-submittable by the new patch set and
to include the unsatisfied submit requirements into the email, we need
to have submit requirement results from before and after the update
available which are computed by calling
ChangeData#submitRequirementsIncludingLegacy().

To be able to create the pre-update ChangeData instance when the email
is being sent we capture the old meta SHA1 during the updateChange step
of the BatchUpdateOps. This means the submit requirements for the
pre-update change state are computed at the moment when the email is
being sent (the submit requirements results are not available in the
updateChange step and hence we cannot provide them to the email sender).
Since the evaluation of submit requirements is expensive it is important
that the email sending is done asynchronously, so that the submit
requirement computation doesn't add up to the latency of the user
request, but that's already the case.

The submit requirement results from after the update are already
computed when the change is (re)indexed due to the update. We can get
this updated ChangeData instance that has the submit requirement results
cached in the postUpdate step of a BatchUpdateOp via
PostUpdateContext#getChangeData(Change) and pass them into the email
sender (so that they do not need to be recomputed there).

To avoid synchronization issues between the main thread and the
background thread that's sending the email we only pass immutable
objects to the background thread that are known to be thread-safe.

Including the unsatisfied submit requirments into the email helps users
understand that a change became unsubmittable and what's blocking the
submission now. It would be possible to include further submit
requirement information (e.g. which submit requirements are still
satisfied/unsatisfied, which submit requirements are newly overriden,
forced or failing), but in order to avoid noise in the email
notifications we didn't include it. The email template has access to the
old and new submit requirement results from before/after the update, so
if anyone wants to include more information this is possible by editing
the template.

Change-Id: Ieda1c79f70b762864f60639bd65ca1bec9a64409
Bug: Google b/230443126
Release-Notes: Included unsatisfied SRs into new patch set email when change becomes unsubmittable
Signed-off-by: Edwin Kempin <ekempin@google.com>
8 files changed
tree: 347bd2850d111287ab605af35a2d49daa2259b45
  1. .settings/
  2. .ts-out/
  3. antlr3/
  4. contrib/
  5. Documentation/
  6. e2e-tests/
  7. java/
  8. javatests/
  9. lib/
  10. modules/
  11. plugins/
  12. polygerrit-ui/
  13. prolog/
  14. prologtests/
  15. proto/
  16. resources/
  17. tools/
  18. webapp/
  19. .bazelignore
  20. .bazelproject
  21. .bazelrc
  22. .bazelversion
  23. .editorconfig
  24. .git-blame-ignore-revs
  25. .gitignore
  26. .gitmodules
  27. .gitreview
  28. .mailmap
  29. .pydevproject
  30. .zuul.yaml
  31. BUILD
  32. COPYING
  33. INSTALL
  34. Jenkinsfile
  35. package.json
  36. README.md
  37. SUBMITTING_PATCHES
  38. version.bzl
  39. WORKSPACE
  40. yarn.lock
README.md

Gerrit Code Review

Gerrit is a code review and project management tool for Git based projects.

Build Status Maven Central

Objective

Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer.

Gerrit simplifies Git based project maintainership by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer.

Documentation

For information about how to install and use Gerrit, refer to the documentation.

Source

Our canonical Git repository is located on googlesource.com. There is a mirror of the repository on Github.

Reporting bugs

Please report bugs on the issue tracker.

Contribute

Gerrit is the work of hundreds of contributors. We appreciate your help!

Please read the contribution guidelines.

Note that we do not accept Pull Requests via the Github mirror.

Getting in contact

The Developer Mailing list is repo-discuss on Google Groups.

License

Gerrit is provided under the Apache License 2.0.

Build

Install Bazel and run the following:

    git clone --recurse-submodules https://gerrit.googlesource.com/gerrit
    cd gerrit && bazel build release

Install binary packages (Deb/Rpm)

The instruction how to configure GerritForge/BinTray repositories is here

On Debian/Ubuntu run:

    apt-get update & apt-get install gerrit=<version>-<release>

NOTE: release is a counter that starts with 1 and indicates the number of packages that have been released with the same version of the software.

On CentOS/RedHat run:

    yum clean all && yum install gerrit-<version>[-<release>]

On Fedora run:

    dnf clean all && dnf install gerrit-<version>[-<release>]

Use pre-built Gerrit images on Docker

Docker images of Gerrit are available on DockerHub

To run a CentOS 8 based Gerrit image:

    docker run -p 8080:8080 gerritcodereview/gerrit[:version]-centos8

To run a Ubuntu 20.04 based Gerrit image:

    docker run -p 8080:8080 gerritcodereview/gerrit[:version]-ubuntu20

NOTE: release is optional. Last released package of the version is installed if the release number is omitted.