- Check a Gerrit server for changesets and build
- The script will search for changes either with +2 code-review or starred by the user given by --review-ssh-user. The script will search for Jenkins jobs owned by the user given by --jenkins-user and use these as baselines to build the changes against. Once the builds have been started, the script will enter a comment in the Gerrit review giving the build URLs.
- Check Jenkins and Lava for build and test results
- The script checks it's state database for previously built changes and checks the result of any build urls it finds. If any builds of a particular changeset failed, a -1 code-review, -1 verified comment is made and the build urls are given in the message. If all builds of a particular changeset succeeded, then a Gerrit comment is made and previous review and verification scores are reset. For changesets where all builds have succeeded, the script queries LAVA for test results. If any tests of a particular changeset failed, a -1 code-review and -1 verified comment is made with the URLs to the LAVA results. If all tests of a particular changeset passed, the code-review score is reset and a +1 verified comment is given with the URLs to the LAVA results and the change is submitted for merging.
- Reset bot scores for a given project/change
- This is an option to allow an administrator to remove the bot's scores for a given change without requiring any rebuilding or resubmission of patches.
- Human gives a Code Review=+2 to a change.
- Bot looks for changes which have Code Review=+2 and don't have Verified=-1 (Verified=-1 could mean bot already processed this change).
- Bot schedules a build for the change, posting comment to Gerrit with build URL.
- Bot watches Jenkins for build completion.
- If build finishes with failure, bot posts comment about this with build URL and gives it Verified=-1 (it doesn't touch Code Review, because build failure can be as well non-deterministic infrastructure failure).
- Human needs to verify that manually, and in case it's indeed non-deterministic failure, ask admin to reset bot score to let it run thru the loop again.
- Otherwise, if build finished successfully, bot posts comment about this with build URL and gives it Verified=0 and Code Review=0 (i.e. resets its previous bad scorings, if any).
- Bot then wait for LAVA tests to finish.
- If LAVA tests failed, bot posts Gerrit comment and leaves change state as is, because we have too many LAVA test issues currently.
- If LAVA tests succeeded, Gerrit comment it posted, Verified=+1 is given, and change merge is attempted (which may fail if change grew old and needs rebasing).
Example 1: Generate builds for all +2 reviewed changes:
Example 2: Generate builds for all fgiff's starred changes:
./androidbotreview.py build-starred fgiff
Example 3: Check for build and test results and add comments to gerrit:
Example 4: Reset the bot's scores in case of an unrelated build failure:
./androidbotreview.py reset-scores --review-project project/path --review-id 54A11D
Configuration is stored in config.py file. Review it for more information.
- Command usage
- File name for script to keep its state database in, default is gerritlogs.
- Gerrit project. Used when resetting bot scores.
- A commit id. Used when resetting bot scores.
Updating gerrit-bot build configs
Build frontend allows only a job owner (gerrit-bot in this case) to update build config of the job, so the process is as follows:
Platform/Android/AndroidBotReview (last modified 2011-12-07 09:54:05)