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 domake clean
.
So, the build results can be seen like this:
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.