gerrit/gerrit-extension-api
Dariusz Luksza 62ef2e5f26 Allow CommitValidationListener to ignore 'skip validation' push option
Gerrit allows users to skip validation of commits on push. Prior to
version 2.15, validation was implicitly skipped when the following
criteria were met:

- The user has the 'push merges', 'forge author', 'forge committer',
  and 'forge server identity' permissions
- The project does not require the 'Signed-off-by' footer

This was originally introduced to improve performance on initial push
of content into a new project, for example when a project is imported
from an external source.

Since changes I80ad47852 and I012e1ea42, introduced in 2.15, skipping
validation is only done when the user (with the permissions) explicitly
specifies the 'skip-validation' push option.

Add a new method on the CommitValidationListener interface, allowing the
validator implementation to override the 'skip-validation' option so
that it gets invoked for all commits. This is useful in companies where
specific validations must be performed for all incoming commits, for
example for security or auditing purposes, regardless of their origin.

For backwards compatibility the new method has a default implementation
that returns false, so that validation is skipped by default as before,
and existing implementations don't need to be adjusted. Validation is
only invoked for the implementations that override the method to return
'true'; other validators are skipped as before.

Change-Id: I7ba197eac4b8edad7a87f1d3d961948f988db60f
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
2019-06-20 13:54:02 +09:00
..
2019-01-09 21:30:53 +09:00
2019-06-13 12:43:56 +09:00