Page MenuHomePhabricator

Install and use JDK 8 for Android CI testing
Closed, ResolvedPublic

Description

Android's tooling and libraries are beginning to require JDK 8 (see, e.g., https://gerrit.wikimedia.org/r/#/c/295674/). From a quick search of ops/puppet and integration/config it looks like only JDK 7 is currently available.

Can we install JDK 8 in our CI environment and use it for Android builds? (If this is something I can do on my own, please point me in the right direction and I will get to it.)

Event Timeline

We had Java 8 made available in apt.wikimedia.org a while back but I am not sure how up to date it is. The packages would be openjdk-8-jdk and openjdk-8-jre with the following versions:

Trusty8u40~b09-1+wm1 Manually imported by ourselves
Jessie8u91-b14-1~bpo8+1from Debian backports

Seems the Trusty version we have imported is probably not being taken care of. I suspect a Java application in production which requires Java 8 is nowadays installed on Jessie systems.

So I guess we want to add the Java 8 on Jessie slaves and migrate the Android CI jobs to Jessie slaves.

Change 295880 had a related patch set uploaded (by Hashar):
contint: Java 8 on Jessie slaves

https://gerrit.wikimedia.org/r/295880

Java 8 is now available on the couple permanent Jessie slaves we have integration-slave-jessie-1001 and integration-slave-jessie-1002 both having the Jenkins labels:

  • contintLabsSlave
  • DebianJessie
Notice: /Stage[main]/Packages::Openjdk_8_jdk/Package[openjdk-8-jdk]/ensure: ensure changed 'purged' to 'present'

https://gerrit.wikimedia.org/r/#/c/295674/ shows two jobs failing: apps-android-wikipedia-lint and apps-android-wikipedia-test which boths are tied to labels contintLabsSlave && UbuntuTrusty. I believe we can just moved them to DebianJessie.

There is also a apps-android-wikipedia-periodic-test which is tied to contintLabsSlave && AndroidEmulator which ends up being tied to a Trusty slave integration-slave-trusty-1023.IIRC it is running on a dedicated instance because the test is quite heavy. I am not sure how puppetized that instance is though.

Mentioned in SAL [2016-06-24T09:54:36Z] <hashar> T138506 Adding a JDK installation "Debian - OpenJdk 8" in Jenkins global configuration with JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

Change 295885 had a related patch set uploaded (by Hashar):
Switch apps-android-wikipedia jobs to Java 8

https://gerrit.wikimedia.org/r/295885

Change 295891 had a related patch set uploaded (by Hashar):
Build step to install Android SDK

https://gerrit.wikimedia.org/r/295891

Have to get the Android SDK installed automagically ( https://gerrit.wikimedia.org/r/295891 ). But the plugin can not detect the platform.

Relevant detection code for the plugin at version 2.13.1 is at
https://github.com/jenkinsci/android-emulator-plugin/blob/android-emulator-2.13.1/src/main/java/hudson/plugins/android_emulator/builder/ProjectPrerequisitesInstaller.java#L66-L120

Namely it:

  • Looks for files matching **/default.properties or **/project.properties
  • parse the file to find a target value which is then used as the Android platform to install

Since we are using Gradle, the platform seems to be defined via:

app/build.gradle:        targetSdkVersion 23

Which is not recognized by the plugin. A hack would be to create a dummy default.properties that set target=23 and leave a comment about keeping them in sync.

Change 295893 had a related patch set uploaded (by Hashar):
Hack to have Jenkins recognize the compile SDK version

https://gerrit.wikimedia.org/r/295893

Before:

00:00:00.740 [android] Searching for Android projects...
00:00:00.876 [android] No Android projects found; wont install any dependencies.

After:

00:00:00.571 [android] Searching for Android projects...
00:00:00.811 [android] Project file 'project.properties' requires platform '24'
00:00:00.886 [android] No Android SDK found; let's install it automatically...
00:00:01.170 Downloading and installing Android SDK from http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
00:00:08.939 [android] Base SDK installed successfully
00:00:09.111 [android] Going to install required Android SDK components...
00:00:09.125 [android] Installing the 'platform-tool' SDK component(s)...
...
00:01:04.982 [android] Ensuring platform(s) are installed: [24]
00:01:04.995 $ /mnt/jenkins-workspace/tools/android-sdk/tools/android list target
00:01:05.948 [android] The configured Android platform needs to be installed: 24

Change 295894 had a related patch set uploaded (by Hashar):
contint: Android SDK deps on all slaves

https://gerrit.wikimedia.org/r/295894

/mnt/jenkins-workspace/tools/android-sdk/build-tools/23.0.3/aapt was falling with 'no such file or directory'. That was due to missing system dependencies on Jessie slaves which are now shipped via https://gerrit.wikimedia.org/r/295894

hashar triaged this task as Medium priority.Jun 24 2016, 11:56 AM

I have rolled back all three jobs back to Trusty (apps-android-wikipedia-lint apps-android-wikipedia-publish apps-android-wikipedia-test).

I believe the CI infra is now ready (with Android SDK auto installed and Java 8 available on Jessie slaves).

We would need to review/agree on the .properties hack for Jenkins in https://gerrit.wikimedia.org/r/#/c/295893/ . Might want to merge it in with the change that bump the library to 24.0.0 https://gerrit.wikimedia.org/r/#/c/295674/

Once fine, we switch the job to Jessie and merge the couple patches for CI configuration https://gerrit.wikimedia.org/r/#/c/295891/ and https://gerrit.wikimedia.org/r/#/c/295885/

Mentioned in SAL [2016-06-24T15:04:01Z] <hashar> switch apps-android-wikimedia-* jobs to Jessie T138506

Change 295893 merged by jenkins-bot:
Hack to have Jenkins recognizes the compile SDK version

https://gerrit.wikimedia.org/r/295893

We are in good shape! Thanks again, @hashar!

You are welcome. Have happy Java 8 hacking!

Change 295891 merged by jenkins-bot:
Build step to install Android SDK

https://gerrit.wikimedia.org/r/295891

Change 295885 merged by jenkins-bot:
Switch apps-android-wikipedia jobs to Java 8

https://gerrit.wikimedia.org/r/295885

Change 295894 merged by Dzahn:
contint: Android SDK deps on all slaves

https://gerrit.wikimedia.org/r/295894

Is this the same thing as "contint: Java 8 on Jessie slaves" ?

Is this the same thing as "contint: Java 8 on Jessie slaves" ?

Yeah the patch that resolved this task is https://gerrit.wikimedia.org/r/#/c/295880/ which I have cherry picked on the CI puppet master.

Moritz commented on the Gerrit patch and I have missed following up on it. It is in my backlog of things to polish up / follow up.

Looked at the patch, we need both java 7 and java 8 on the Jessie slaves.

Change 295880 merged by Dzahn:
contint: Java 8 on Jessie slaves

https://gerrit.wikimedia.org/r/295880

Thanks @hashar for the clarification here and on gerrit.

merged!

Dzahn claimed this task.
Dzahn removed Dzahn as the assignee of this task.
Dzahn assigned this task to hashar.

Mentioned in SAL [2016-08-25T20:10:23Z] <hashar> Delete integration-slave-trusty-1023 with label AndroidEmulator. The Android job has been migrated to a new Jessie based instance via T138506