trigger is the Gerrit trigger written in Go.
- Go >= 1.21.0
version=latest make build
./bin/trigger --config-file="$PWD"/config/config.yml
version=latest make docker
docker run -v "$PWD"/config:/tmp ghcr.io/gerrittrigger/trigger:latest --config-file=/tmp/config.yml
usage: trigger --config-file=CONFIG-FILE [<flags>]
gerrit trigger
Flags:
--help Show context-sensitive help (also try --help-long
and --help-man).
--version Show application version.
--config-file=CONFIG-FILE Config file (.yml)
--log-level="INFO" Log level (DEBUG|INFO|WARN|ERROR)
trigger parameters can be set in the directory config.
An example of configuration in config.yml:
apiVersion: v1
kind: trigger
metadata:
name: trigger
spec:
connect:
frontendUrl: http://localhost:8080
hostname: localhost
name: gerrit
http:
password: pass
username: user
ssh:
keyfile: /path/to/.ssh/id_rsa
keyfilePassword: pass
port: 29418
username: user
playback:
eventsApi: http://localhost:8081/events
trigger:
events:
- name: "comment-added"
commentAdded:
verdictCategory: "Verified"
value: "1"
commentAddedContainsRegularExpression:
value: "Code-Review"
- name: "patchset-created"
commitMessage: "message.*"
patchsetCreated:
excludeDrafts: false
excludeTrivialRebase: false
excludeNoCodeChange: false
excludePrivateChanges: false
excludeWIPChanges: false
uploaderName: "name"
projects:
- branches:
- pattern: main
type: plain
filePaths:
- pattern: name
type: plain
forbiddenFilePaths:
- pattern: "**/name"
type: path
repo:
pattern: ".*"
type: regexp
topics:
- pattern: name
type: plain
watchdog:
periodSeconds: 20
timeoutSeconds: 20
- spec.connect.frontendUrl: Gerrit URL
- spec.connect.hostname: Gerrit address
- spec.trigger.events.name: See Events
- spec.watchdog.periodSeconds: Period in seconds (0: turn off)
- spec.watchdog.timeoutSeconds: Timeout in seconds (0: turn off)
batch-ref-updated
change-abandoned
change-deleted
change-merged
change-restored
comment-added
commit-received
hashtags-changed
patchset-created
private-state-changed
project-created
project-head-updated
ref-received
ref-replicated
ref-updated
reviewer-added
reviewer-deleted
topic-changed
vote-deleted
wip-state-changed
GERRIT_BRANCH
GERRIT_CHANGE_COMMIT_MESSAGE
GERRIT_CHANGE_ID
GERRIT_CHANGE_NUMBER
GERRIT_CHANGE_OWNER
GERRIT_CHANGE_OWNER_EMAIL
GERRIT_CHANGE_OWNER_NAME
GERRIT_CHANGE_PRIVATE_STATE
GERRIT_CHANGE_SUBJECT
GERRIT_CHANGE_URL
GERRIT_CHANGE_WIP_STATE
GERRIT_EVENT_TYPE
GERRIT_HOST
GERRIT_NAME
GERRIT_PATCHSET_NUMBER
GERRIT_PATCHSET_REVISION
GERRIT_PATCHSET_UPLOADER
GERRIT_PATCHSET_UPLOADER_EMAIL
GERRIT_PATCHSET_UPLOADER_NAME
GERRIT_PORT
GERRIT_PROJECT
GERRIT_REFSPEC
GERRIT_SCHEME
GERRIT_TOPIC
Project License can be found here.