Build and Test with Docker
Erik Joelsson
erik.joelsson at oracle.com
Mon Mar 23 13:43:36 UTC 2020
Hello Philipp,
On 2020-03-21 12:37, Philipp Kunz wrote:
> Hi everyone,
>
> When I started contributing I went through all the building and testing
> instructions [1] and after I had bought a new computer recently, it
> occurred to me that this could as well be simplified with docker.
>
> What I found was not a lot, surprisingly. A simple test called
> DockerBasicTest inside the Open Jdk that does nothing with building or
> testing the jdk but only runs the built jdk image as I understood after
> a quick glance. To mention is also AdoptOpenJDK [2] which says it does
> not work at the moment, which I haven't even tried myself so far. I
> haven't found anything related in the mailing list archives nor in the
> bugs.
>
> What I searched and if that really does not yet exist I want to propose
> is kind of an additional section to the building and testing
> instructions at [1] that basically says which docker image to use as an
> alternative to prepare a computer accordingly. The usage should be as
> simple as possible: 1. checkout jdk, 2. docker build ..., 3. docker run
> .... Unlike [2] I would suggest multi-arch images [3].
>
> Again, did I just not find the relevant thing? If so, I will be
> grateful for a hint where to look, apologize for this spam, and vote
> for anything to make also others find it easier.
>
> In my opinion, the Open Jdk itself would be the right place to maintain
> a few dockerfiles so that these can be changed and maintained together
> with the Open Jdk as it evolves along with its build and testing
> instructions.
>
> It would probably require quite limited effort only, basically
> extracting the build and testing instructions into a few architecture
> depending scripts and reference them from one or a few new dockerfiles.
>
> This might also help to save a lot of time to existing contributors and
> help others to start contributing with a lower threshold to get
> started.
I have heard similar requests a couple of times before, but I'm not
quite sure what problem this is supposed to solve. There are 3 main
reasons to build OpenJDK.
1. An OpenJDK developer builds while developing and testing changes.
2. A user builds OpenJDK to run on their own machine.
3. A distributor builds OpenJDK to distribute the binaries to multiple
different users.
If I understand you correctly, you are trying to solve problem 1, to
lower the threshold for new OpenJDK developers. To use Docker
meaningfully, you would be developing on Linux. In my experience,
getting a working build environment for local development on Linux is by
far the easiest platform. The reason for this is that we have so many
contributors already building on a vast variation of different
distributions and versions of Linux, so most problems are getting solved
rather quickly. Still, a dockerfile would be even easier at first, but
would also be clunkier to work with. Having to go through docker for
every incremental build command gets annoying, ctrl-c doesn't work as
reliably and debugging through docker is messy. I just don't think many
developers would be interested in such a workflow.
For 2, if you want to compile OpenJDK for your own specific machine and
Linux installation, then you most likely want to use your local
toolchain and system libraries. Otherwise you wouldn't be compiling
yourself, but could just as well download prebuilt binaries from an
existing distributor.
Finally for 3, it could make sense to build in docker, but that would be
something each distributor would have to setup themselves to suit their
specific build needs, which are in turn based on their OS support matrix
(and a slew of other external factors, which can be both technical and
legal), something each distributor defines for themselves.
Common to all of these scenarios is the problem of who defines the
"official" build platforms for OpenJDK. We currently don't have any. We
maintain (sort of) a wiki page [1] with build configurations used by
some distributors (such as Oracle and SAP), but no distributor is
currently defining their build environments as the official for OpenJDK.
Because of all this, I don't think anyone in OpenJDK is currently
interested in spending resources on maintaining such dockerfiles. But,
if someone wants to contribute and maintain dockerfiles that are known
to work to produce a reasonably compatible build of OpenJDK, then I
don't see a problem with accepting them into the source tree.
/Erik
[1] https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms
> Does that sound reasonable? Any opinions?
> Regards,
> Philipp
>
>
> [1] https://hg.openjdk.java.net/jdk/jdk/file/12eb1e2087d2/doc
> [2] https://github.com/AdoptOpenJDK/openjdk-build/tree/master/docker
> [3] https://docs.docker.com/registry/spec/manifest-v2-2/
>
>
More information about the build-dev
mailing list