Create a generic gerrit plugin to forward command to tb3
Ci-infra bugs are now tracked in redmine. Copied from bugzilla bug #70375
Bjoern is working on tb3, a replacement of the server side tinderbox
In order to use the tb script to communicate with tb3 and to avoid implementing and managing yet another authentification scheme, it is preferable to re-use gerrit existing infrastructure
hence the need for a plugin that would
+ accept incoming call from tb
+ check that the user belong to a given (configuration) ACL group
+ prepend to the command line argument --user='<user name>' and --groups='list of groups the user belong too'
the list of the group can be filtered by configuration to only include the listed one in the configuration
+ run a local command using a configured program name and the argument given by the user prepended as above (do not use a shell wrapper, invoke the program directly to avoid variable expansion redirection and other nasty trick... even better sanitize the input command line. redirect the incoming read-side socket to stdin and stdout to the outgoing socket (stderr is redirected to a log file (configured) or /dev/null if no such logfile is configured
if a logfile is configured log before and after call even with the then timestamp and the command line received
+ ideally the plugin should be 'nameable' in other word one would be able to rename the jar and get a new plugin command forwarder based on the jar name. if that is not technically possible.
The reason for that is that gerrit allow to enable/disable individual plugin, which in turn would allow a gerrit admin to quickly and without disturbing the rest of gerrit to turn on/off a given forwarder... while allowing multiple such forwarded to exist to deal with multiple external services as tb3 is likely not going to be the only one to use that scheme if that prove successful