2

we have

current build environment setup:

  • Android project consist of hundreds and hundreds repos.
  • for code review process using Gerrit
  • build server Jenkins
  • one build plan which is triggered by two ways:
    • CI build type: Gerrit Trigger when there was a patchset created
    • NIGHTLY build type: by a timer (every night)
  • one shell script which handles both scenarios based on whether $GERRIT* variables were set or not. The other difference what that script does, for NIGHTLY we do make clean.

So, the build results can be seen like this:

Build History of CI & Nightly in one view

Not entirely sure what was the original motivation to do it in this way, but

benefits could be:

  • less disk space, need only 1 Jenkin's workspace
  • maybe initial faster building time
  • in one view can see the status of CI and NIGHTLY builds

However the disadvantages are:

  • Cannot conditional build NIGHTLY (and by timer) when there was not difference between previous NIGHTLY and the current one (I'm able to do that in the shell script to retrieve last/true NIGHTLY repo manifest, but that's already when the Jenkins triggered the build...so have already a void record, as I'm exiting at this stage my script). Because what will tell the difference over the hundreds of Android repositories is the .repo/manifest.xml file left on the disk from the last (most probably CI, based on Gerrit changeset) build and the current nightly.
  • also not always correct info about changes between builds (both types)

Where I got to so far?

  • learned about Run Condition Plugin, but haven't figure out how to pass to it the last/true NIGHTLY build repo/manifest.xml and the same with the current manifest before I start building it (calling repo forall -c 'git checkout origin/otira_development')
  • Usage of Jenkins CLI plugin to trigger a Jenkins build from there. So far the closest and I think achievable. But still I feel - why I need Jenkins at all if the whole logic I need resides in external scripts.
  • someone point me to this question about how to get changes since the last build. However I don't have any idea how to implement it in Jenkins.

Anyone has any experience of building Android project(s) using Jenkins and Gerrit? What is your solution? How to achieve have NIGHTLY triggered if there was true change on the master (ignore CI Gerrit builds). Also see the true changes between builds (especially NIGHTLY, as they get affected by this implementation).

Ideal to me seems to have two separate build plans using two separate workspaces, however I'm limited with the disk space, so cannot afford this. If that helps, here's our build script.

DelphyM
  • 322
  • 2
  • 14
  • for what purpose are you using jenkins? for creating Android APKs without Android Studio? Im asking...... – Zaid Mirza Jul 16 '18 at 05:13
  • We're build an Android platform (not APK), so Jenkins build is triggered: - by Gerrit change-set to verify (gives +1) for buildability of the change. - by a timer, to `make clean` nightly build, so we got Android OS images which we flash to devices and run CTS tests on them. I've already asked myself - why actually I need to use Jenkins, if still I have to write all the build logic in an external script(s). For CI it seems the benefit is that it can be triggered automatically by Gerrit, but for Nightly I pretty much don't need it, but it'd be nice to have a record it was built. – DelphyM Jul 16 '18 at 23:04

0 Answers0