[FOLIO-2637] SPIKE: Add Java 11 support to Jenkins Pipelines. Created: 05/Jun/20 Updated: 17/Aug/20 Resolved: 17/Aug/20 |
|
| Status: | Closed |
| Project: | FOLIO |
| Components: | None |
| Affects versions: | None |
| Fix versions: | None |
| Type: | Task | Priority: | P2 |
| Reporter: | Taras Spashchenko | Assignee: | Ian Hardy |
| Resolution: | Done | Votes: | 0 |
| Labels: | devops | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original estimate: | Not Specified | ||
| Issue links: |
|
||||||||||||||||||||||||||||||||||||
| Sprint: | DevOps: Sprint 95, DevOps: sprint 94 | ||||||||||||||||||||||||||||||||||||
| Development Team: | FOLIO DevOps | ||||||||||||||||||||||||||||||||||||
| Description |
|
Use openjdk-11-jdk to build java/maven modules. https://github.com/folio-org/folio-tools/blob/master/jenkins-slave-docker/Dockerfile currently uses openjdk-8-jdk (Java 8) to build java modules by running maven. SonarQube Server running on https://sonarcloud.io/organizations/folio-org/projects requires openjdk-11-jdk (Java 11) to build using maven from October 2020 on: https://sonarcloud.io/documentation/upcoming/ Quote from https://docs.sonarqube.org/latest/requirements/requirements/ :
JDK 11 can build Java 8 and Java 11 code. Example:
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
I've successfully build RMB for Java 8 using openjdk11. The result jar can still run under JRE 8. |
| Comments |
| Comment by Julian Ladisch [ 22/Jun/20 ] |
|
I recommend to base this new enkins-slave-docker/Dockerfile image on Ubuntu Focal (20.04 LTS). Ubuntu Xenial is rather old (2016) and already requires many manual installations that could be avoided by using Focal distribution packages: nodejs, postgres, yarn, docker |
| Comment by Ian Hardy [ 12/Aug/20 ] |
|
Created an image of the Jenkins image based on focal, taking Julian's advice, with Java 11 and tagged it as folioci/jenkins-slave-all:java-11. The Dockerfile is on a branch until we can verify. https://github.com/folio-org/folio-tools/tree/folio-2637-java-11-image A few notes, I kept things mostly the same other than java-11 and whichever utilities we were getting through the linux package manager. Updated from Ansible 2.7.5 to 2.7.18. Python 2 is no longer available. We shouldn't be using it anymore anyway since it's no longer maintained but something to keep in mind. Left Node, ruby, docker alone. |
| Comment by Adam Dickmeiss [ 14/Aug/20 ] |
|
This blocks release of OKAPI and RMB for Q3 that should be released today. |
| Comment by Ian Hardy [ 14/Aug/20 ] |
|
Hi Adam Dickmeiss, please try setting buildNode = 'jenkins-agent-java11' in the Jenkinsfile. See example on https://folio-org.atlassian.net/browse/FOLIO-2718. |
| Comment by Adam Dickmeiss [ 14/Aug/20 ] |
|
Seems to work. Should this be applied to all projects migrating to OpenJDK 11 or is this a temporary solution and it will be the default? |
| Comment by Ian Hardy [ 14/Aug/20 ] |
|
Yes, needs to be applied to all projects that need jdk 11. I believe the plan was to make this an option at first, then change it to be the default build agent later. |
| Comment by Ian Hardy [ 14/Aug/20 ] |
|
Also, base image needs to be updated to folioci/alpine-jre-openjdk11:latest in the Docker file if applicable. We tried this in okapi but the healthcheck failed. Possible the base image needs more testing. |
| Comment by Hongwei Ji [ 14/Aug/20 ] |
|
Ian Hardy, the reason Okapi build failed (docker health check) is because the base image does not have curl installed. Add curl to https://github.com/folio-org/folio-tools/blob/master/folio-java-docker/openjdk11/Dockerfile should do it. |
| Comment by Ian Hardy [ 17/Aug/20 ] |
|
Hongwei Ji, many thanks! In summary, to use jdk 11 for your build in jenkins, you must set buildNode = 'jenkins-agent-java11' in the Jenkinsfile, and update the base image in your docker file to use folioci/alpine-jre-openjdk11:latest . |