commit | 00d9054fe648ff69443e777cb78e8357216cbaf3 | [log] [tgz] |
---|---|---|
author | Han-Wen Nienhuys <hanwen@google.com> | Mon Jan 27 19:22:09 2020 +0100 |
committer | Han-Wen Nienhuys <hanwen@google.com> | Wed Jan 29 14:22:39 2020 +0100 |
tree | 2ae6f21f9108ac0a386bc862afab6a88593abddc | |
parent | 78f3016e17ec0350a567e2f4854549cafc22d459 [diff] |
Add --gcp_service_account option, remove --cookies option. This lets the linter request tokens directly from GCP, obviating the daemon at https://gerrit.googlesource.com/gcompute-tools/ . This will make deployment as a docker container on GCP simpler. To achieve this, introduce an Authenticator interface to capture both bearer tokens and Basic Auth as authentication mechanisms. Drop dependency on slothfs. Tested: Ran it on the gerrit-linter instance we currently run. Change-Id: Idab7ea5ba93134deb8090586fb37aaaa00da214a
This is a style verifier intended to be used with the Gerrit checks plugin.
go install github.com/bazelbuild/buildtools/buildifier curl -o google-java-format.jar https://github.com/google/google-java-format/releases/download/google-java-format-1.7/google-java-format-1.7-all-deps.jar
Obtain an HTTP password, and put it in testsite-auth
. The format is username:secret
.
Register a checker
go run ./cmd/checker -auth_file=testsite-auth --gerrit http://localhost:8080 \ --language go --repo gerrit --register
go run ./cmd/checker -auth_file=testsite-auth --gerrit http://localhost:8080 \ --list
go run ./cmd/checker -auth_file=testsite-auth --gerrit http://localhost:8080
For simplicity of deployment, gerritfmt checker is stateless. All the necessary data is encoded in the checker UUID
handle file types (symlink) and deletions
more formatters: clang-format, typescript, jsformat, ... ?
isolate each formatter to run with a separate gvisor/docker container.
tests: the only way to test this reliably is to spin up a gerrit server, and create changes against the server.
Update the list of checkers periodically.
This currently runs the formatters without sandboxing. Critical bugs (heap overflow, buffer overflow) in formatters can be escalated to obtain the OAuth2 token used for authentication.
The currently supported formatters are written in Java and Go, so this should not be an issue.
This is not an official Google product