Service has a REST API to collect so called “scores” from various sources (Jira, Gerrit,
Jenkins, wiki); a set of triggers which check people ranks; and a bot API to post
events to Slack channels. Scores are POSTed to the service for the actions like
new review, new bug report and so on. Once person collects enough scores (per day,
per week...) he receives a message/badge from ScoreBot.
- Docker 1.10 or later
- Docker-compose 1.10 or later
Get source code:
git clone https://github.com/cloudlinux/scorebot.git && cd scorebot
Create and fill your local config file:
cp ./config/config{_sample,}.py
vi ./config/config.py
./ops/start_service.sh
./ops/stop_service.sh
WARNING: this drops all the data. Backup before stopping!
Scorebot uses CouchDB to store its data, this is the only state that requires backup.
./ops/backup_db.sh
You may want to run this from /etc/cron.daily/ (will require cd
to scorebot).
Backups will be stored at ./backups/
Restore does not require stopping the service API, however you may want to do
this to avoid HTTP 500 ret-codes while DB is being restarted.
./ops/restore_db.sh ./backups/<name_of_the_backup>
Can be done via webhook which calls scorebot REST API. Currently supported API endpoints:
curl -X POST -d '{"player_name": "mlobur"}' http://server:8080/scores/patchset_reviewed
curl -X POST -d '{"player_name": "mlobur"}' http://server:8080/scores/patchset_proposed
curl -X POST -d '{"player_name": "mlobur"}' http://server:8080/scores/patchset_merged
Gerrit does not have webhooks, but scorebot can still be intergrated though a Jenkins job. See example HERE
TBD. More to come once scorebot has corresponding triggers and API endpoints.
Pull requests welcome. Source code is distributed under MIT.
Create venv: ./dev/mk_venv.sh
(requires virtualenv wrapper)
Start DB: ./dev/db.sh
(non-blocking)
Start API: ./dev/server.sh
(blocking, must be run from venv)
Posting a score:
curl -X POST -d '{"player_name": "rnoyce"}' http://localhost:8000/scores/patchset_reviewed
Populating DB with a huge batch of test scores:
python dev/gen_test_data.py