Linaro Android Bot Review is a script to assist with the continuous integration loop for android. It was deployed against the Linaro gerrit server on 20111017. These are the main functionalities:

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.


  1. Human gives a Code Review=+2 to a change.
  2. Bot looks for changes which have Code Review=+2 and don't have Verified=-1 (Verified=-1 could mean bot already processed this change).
  3. Bot schedules a build for the change, posting comment to Gerrit with build URL.
  4. Bot watches Jenkins for build completion.
  5. 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).
  6. 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.
  7. 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).
  8. Bot then wait for LAVA tests to finish.
  9. If LAVA tests failed, bot posts Gerrit comment and leaves change state as is, because we have too many LAVA test issues currently.
  10. 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:

./ build-reviewed

Example 2: Generate builds for all fgiff's starred changes:

./ build-starred fgiff

Example 3: Check for build and test results and add comments to gerrit:

./ gerrit-comments

Example 4: Reset the bot's scores in case of an unrelated build failure:

./ reset-scores --review-project project/path --review-id 54A11D


Configuration is stored in 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:

  1. Jenkins admin renames a job to be editable in the frontend by them (e.g. gerrit-bot_pandaboard to pfalcon_pandaboard).

  2. Jenkins admin edits config in the frontend.
  3. Jenkins admin renames job back.
  4. If you don't have permissions to do the above, please submit a ticket.

Platform/Android/AndroidBotReview (last modified 2011-12-07 09:54:05)