Dockerfile for Building and Testing Openj9

At Eclipse OpenJ9, we have the challenge of wanting to build and test many versions of SDKs on many platforms. At the same time, we are constrained by the complexity of the machine configuration and setup, and by the number of machines that we have access to and are able to add to our continuous integration server (Jenkins). To address these challenges, one of the features of our build system that we have looked at is to create a Docker image that is set up to allow us to build and test OpenJ9 builds. This would allow us to fire up many Docker images and expand our build farm elastically at a lower cost than adding real and/or “cloud” machines. To achieve this goal, the Docker swarm plugin connects Jenkins to a Docker swarm and uses its services to create individual docker containers from a common image and connect them as Jenkins agents.

First and foremost, the Dockerfile can achieve multiple functions. When running the container, machines would be built on CentOS6 6.9 Linux (FROM centos:centos6.9). CentOS 6.9 has the lowest GLIBC version that our SDK is supported on. Compiling on the lowest GLIBC level means the SDK will run on any OS with that version or newer. All other packages that are required to compile the SDK (e.g. git, autoconf) and also to run the test suites (eg. Perl, Ant) are pre-installed in the container [1]. Moreover, ssh-server is added to enable the Jenkins master to connect to each machines using a predetermined SSH key pair.

Another advantage of having this container available is it allows developers to pull locally and compile and test their code without having to setup an environment.

Commands to build & run:

# First copy your Public SSH key into a file named authorized_keys next to the Dockerfile.
$ docker build -t:<Container Name> /path/to/Dockerfile_directory
$ docker run -it <Container Name> /bin/bash
$ su - jenkins

From here you would compile and test as you would in any other environment.

Please note the locations of the boot JDKs, Freemarker, and Cuda libraries if you wish to compile in the container. The Boot JDKs needed to compile are sourced from AdoptOpenJDK and are currently targeted at the latest OpenJ9 release.

Ex.

bash ./configure  --with-freemarker-jar=/home/jenkins/freemarker.jar --with-boot-jdk=/usr/lib/jvm/adoptojdk-java-90/ --with-cuda=/usr/local/cuda-7.5

 

What are the motivations for writing this Dockerfile? Our two major reasons for using Docker and Docker Swarm is that all our Docker based farm machines will have the exact same configuration and will be more like cattle instead of pets [2]. Second, when a change to the machines is needed, instead of manipulating them one by one, a Pull Request can be made against the Dockerfile and the change will take effect on every new machine created.

In conclusion, this Dockerfile is written to address both problems with the complicated processes of building and maintaining clusters of machines as well automatically adding nodes to our build farm on demand. Some future perspectives we are looking towards are supporting more operating systems (e.g Ubuntu, Red Hat, Windows and MacOS) and architectures that Docker Supports (e.g. PowerPC (ppc64le), Z Mainframe (s390x) and ARM).  Furthermore, In order to minimize disruption in the continuous integration pipelines at Eclipse OpenJ9, we will be refining this approach on a non-production Jenkins server first, to hash out the details, try out some additional optimizations in testing, and gather some additional metrics. We will also need to source a machine that will be able to provision these containers at scale.

1 Reply to “Dockerfile for Building and Testing Openj9”

Leave a Reply