Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement OpenJDK 9 Image #129

Merged
merged 28 commits into from
Aug 23, 2017
Merged

Implement OpenJDK 9 Image #129

merged 28 commits into from
Aug 23, 2017

Conversation

aslo
Copy link
Contributor

@aslo aslo commented Aug 10, 2017

This PR adds an openjdk:9 image, which can be built alongside the existing openjdk:8 image.

Other notable changes:

  • Created two new maven modules, openjdk-common and openjdk-test-common to store common resources and tests between the two images.
  • Modified the build.sh script to require a module (openjdk8 or openjdk9)to be specified, as we will be building/releasing only one image at a time
  • Moved structure_test.sh and local_integration_test.sh into the integration-test phase of the maven build. This simplifies both the maven and the cloudbuild.yaml configuration

Still TODO:

Copy link
Member

@meltsufin meltsufin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.
I think the big thing we're missing here is an integration test that exercises a Java 9 app. It might be possible to write a structure test for the JDK 9 image that tries to compile a simple Java 9 class.
Also, maybe we can configure test-application to have a java9 profile, or maybe we just need a separate test app.

DEVELOPING.md Outdated
```
The resulting image is called openjdk
The resulting image(s) are called openjdk.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..with tags differentiating the version (openjdk:8 and openjdk:9).

DEVELOPING.md Outdated
$ mvn clean install

# only build the openjdk8 image
$ mvn clean install -am -pl openjdk8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use non-abbreviated flags? For example, --also-make.

- '--batch-mode'
- '-Ddocker.image.name=${_IMAGE}'
# only build the specified module
- '--projects=${_MODULE}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't ${_MODULE} need to be a separate argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would appear not - the mvn executable is able to deal with arguments of the form "foo=bar".

echo "Building app container..."
docker build -t $APP_IMAGE . || gcloud docker -- build -t $APP_IMAGE .
docker build -t $APP_IMAGE . || docker -- build -t $APP_IMAGE .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had gcloud docker so that you can pull project-private images from GCR to test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

FYI this means we'd need to use a maven/docker cloudbuild step, like we do in jetty, but that shouldn't be too difficult to set up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess one option is to add gcloud only if the Cloud SDK installation is detected.

commandTests:
- name: 'correct java version is installed'
command: ['java', '-version']
expectedError: ['openjdk version "${openjdk.version.major}-Debian"']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is interesting. They changed the -version output: https://blogs.oracle.com/java-platform-group/a-new-jdk-9-version-string-scheme and http://openjdk.java.net/jeps/223 -- we should follow this with our parsing logic so that it stays maintainable and we don't lose out on ensuring the minor version.

Based on above I'm confused by the -Debian part - where did that get introduced. It also might be part of the major version?

openjdk version "9-Debian"
OpenJDK Runtime Environment (build 9-Debian+0-9b181-2)
OpenJDK 64-Bit Server VM (build 9-Debian+0-9b181-2, mixed mode)

java 8:

Start command: java -showversion -Xms51137M -Xmx51137M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+PrintCommandLineFlags -version
-XX:InitialHeapSize=53621030912 -XX:MaxHeapSize=53621030912 -XX:+ParallelRefProcEnabled -XX:+PrintCommandLineFlags -XX:+UseG1GC 
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -Debian suffix likely is there due to the fact that we're installing openjdk currently from the "unstable" debian package repository. I'm not sure if debian builds of openjdk9 will always have this suffix, but I'd hope at least that they will follow the new version scheme spec. I haven't seen clear info on this yet.

Alex Sloan and others added 10 commits August 14, 2017 11:07
…ntime into openjdk-9

* 'openjdk-9' of github.com:GoogleCloudPlatform/openjdk-runtime:
  fixing bad typo in monitoring integration test (#131)
  fixes integration test flakiness (#130)
…ntime into openjdk-9

* 'openjdk-9' of github.com:GoogleCloudPlatform/openjdk-runtime:
  adding deployment token as a check before integration tests (#133)
@aslo
Copy link
Contributor Author

aslo commented Aug 21, 2017

@meltsufin @cassand @balopat I've addressed all remaining TODOs and I believe I've addressed all PR comments. Mind giving this another review?

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed the Dockerfile

ENV GAE_IMAGE_LABEL ${docker.tag.long}

RUN \
# add debian 'sid' repo in order to install openjdk-9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? this is not the 'sid' anymore it's buster. Maybe a link https://wiki.debian.org/DebianBuster would be good too.

# jdk and its dependencies
ca-certificates-java=20170531'*' \
openjdk-9-jdk-headless=${openjdk.version}'*' \
libcups2=2.2.1-8~bpo8+1 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put in a comment above or here, why we need to downgrade libcups2?
I would even double check if we can remove it completely! (unless of course we want to explicitly support printing from cloud deployed apps or rather the JDK has some weird dependency on CUPS)

openjdk-9-jdk-headless=${openjdk.version}'*' \
libcups2=2.2.1-8~bpo8+1 \
# system utilities
procps \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need procps? jdk8 doesn't have it!

unzip \
&& apt-get clean \
&& rm /var/lib/apt/lists/*_*

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw jdk8 has wget, jdk9 doesn't. Why the discrepancy and why is it needed at all in jdk8? can we remove it? (maybe a separate issue)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 You're right, it's not necessary. Created #135 to track removing it from openjdk:8.

&& rm /var/lib/apt/lists/*_*

# Add the cloud debugger libraries
ADD https://storage.googleapis.com/cloud-debugger/appengine-java/current/cdbg_java_agent.tar.gz /opt/cdbg/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the same for jdk8 and 9? Btw, I can't find this URL anywhere documented, is this specifically built for GAE-java runtimes? The official docs from the debugger point to the GCE link: https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd think this should be the same, but the fact that that URL references wheezy gives me pause. I'll ask around for the current best practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to circle back on this - this is indeed the correct path for the app engine cloud debugger binary. There are no public docs because it's installed automatically and transparently to the user.

&& rm /opt/cdbg/cdbg_java_agent.tar.gz \
&& chmod +x /docker-entrypoint.bash /shutdown/*.bash /setup-env.d/*.bash \
&& mkdir /var/log/app_engine \
&& chmod go+rwx /var/log/app_engine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all this is completely duplicated across jdk8 and 9 - I'm not sure we can get rid of this easily but it might worth to have another thought about some kind of templating setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point.

It looks like some of the openjdk images on dockerhub actually generate static dockerfiles, but then they commit them so it's completely transparent and easy to understand. Maybe that's something we can look into in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a cool approach, I created #136 we can continue to discuss it there.

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1st review on test-app: the out folder with compiled classes should not be committed in my understanding to git. Any special reason for it?

@aslo
Copy link
Contributor Author

aslo commented Aug 21, 2017

👍 Thanks @balopat ! The out directory was committed by mistake - good catch.

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md + 2 more thoughts:

1.) Have you thought about compiling the test-application with Java 9? In the end it would bring out GCP library (in)compatibilities quicker...? On the other hand maven is not necessarily there yet to build Java9 apps.

2.) Philosophical question: Is the compilation test a structure test or an integration test? I'd think it's an integration test, but I can be convinced.

README.md Outdated
![Build Status](http://storage.googleapis.com/java-runtimes-kokoro-build-badges/openjdk-runtime-master.png)

![Stability](https://img.shields.io/badge/gcr.io/google--appengine/openjdk:8-stable-green.svg)
![Stability](https://img.shields.io/badge/gcr.io/google--appengine/openjdk:9-unstable-red.svg)

# Google Cloud Platform OpenJDK Docker Image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in README.md:

 This image is mirrored at both `launcher.gcr.io/google/openjdk8` and `gcr.io/google-appengine/openjdk`.

I think we'll need to update this for openjdk9 as well I guess? How do we differentiate between 8 and 9 in the google-appengine version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how does 8 vs 9 affect runtime:java?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we should update this. I'm not sure what's involved in getting images added to launcher.gcr.io. @meltsufin Is this something we should look into?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runtime: java is still correct. The user selects between openjdk8/9 using runtime_config.jdk (see below). Until we release the openjdk:9 image and add it to the runtime builder, jdk: openjdk9 won't be available. I'll update the readme to reflect the current state.

runtime_config:
  jdk: openjdk8

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, the structure test is a valid positioning for this - however, this case, please rename the test-app to java9-compilation-test or something similar.

@balopat
Copy link
Contributor

balopat commented Aug 21, 2017

if we add new JVM options which are specific for the openjdk-9 runtime (see for example #137) - where would they fit in this multi-module design?

@aslo
Copy link
Contributor Author

aslo commented Aug 22, 2017

I'd think they should live in the src/main/docker dir within the module that they're specific to. Then the dockerfile would have access to them during the docker build. If we wanted to set additional JVM flags, we could add a script to the setup-env.d directory that modifies the args accordingly.

@balopat
Copy link
Contributor

balopat commented Aug 22, 2017

Great, in my opinion, this is all solid work, great job! LGTM

@aslo
Copy link
Contributor Author

aslo commented Aug 23, 2017

@meltsufin Do you mind giving this another review so it can be merged? Thanks!

Copy link
Member

@meltsufin meltsufin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! LGTM!

@aslo aslo merged commit dc3c6a8 into master Aug 23, 2017
@aslo aslo deleted the openjdk-9 branch August 23, 2017 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants