Do not fail if user is missing username attribute
The serviceuser plugin provides a commit validator that checking each
pushed commit, whether the committer is a serviceuser.
If the validation fails the push fails, even if the user is no
serviceuser.
Backtrace:
[SSH git-receive-pack xxx] WARN com.google.gerrit.server.git.
MultiProgressMonitor : MultiProgressMonitor worker did not call end()
before returning
[SSH git-receive-pack xxx] ERROR com.google.gerrit.server.git.receive.
AsyncReceiveCommits : error while processing push
java.util.concurrent.ExecutionException: java.util.NoSuchElementException:
No value present
Caused by: java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:148)
at com.googlesource.gerrit.plugins.serviceuser.GetServiceUser.
apply(GetServiceUser.java:61)
at com.googlesource.gerrit.plugins.serviceuser.ServiceUserResolver.
getAsServiceUser(ServiceUserResolver.java:91)
at com.googlesource.gerrit.plugins.serviceuser.ValidateServiceUserCommits.
onCommitReceived(ValidateServiceUserCommits.java:52)
Users without username attribute are valid in case of OAuth and other
providers until user once set them.
This change ignores users that are missing username attribute.
Change-Id: I505edc7689ab0e9bd8adee42508badf9bdcec867
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
1 file changed