Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Implement OpenJDK 9 Image #129

Merged
merged 28 commits into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e7dbce4
Refactor common docker scripts into separate module
Aug 10, 2017
eed3343
Refactor common test resources into separate module
Aug 10, 2017
3d6d093
Configure openjdk8 and openjdk9 modules
Aug 10, 2017
22d4431
Fixup build scripts for new structure
Aug 10, 2017
c0f3b12
Update documentation
Aug 10, 2017
6fe1988
Update travis config to support build-time dependencies
Aug 10, 2017
c29413c
Remove the use of envsubst in local_integration_test
Aug 10, 2017
a5948b5
Clarify documentation
Aug 11, 2017
1d3ba38
Add structure test for project jigsaw features
Aug 14, 2017
b4e5814
Add stability badges to readme
Aug 14, 2017
c40c952
Install jdk9 from testing repository
Aug 14, 2017
ba1386d
Merge branch 'master' into openjdk-9
Aug 14, 2017
334a90d
Fix gcloud docker usage in local_int_test
Aug 14, 2017
82f8aae
Merge branch 'openjdk-9' of github.com:GoogleCloudPlatform/openjdk-ru…
Aug 14, 2017
ba85465
Fix structure test execution in cloudbuild environment
Aug 14, 2017
e822405
Merge branch 'master' into openjdk-9
balopat Aug 14, 2017
93b0090
Update build scripts
Aug 21, 2017
6352951
Merge branch 'openjdk-9' of github.com:GoogleCloudPlatform/openjdk-ru…
Aug 21, 2017
dce4a86
Rm compiled test app
Aug 21, 2017
f2bf7b5
Add variables for openjdk9 minor (update) version
Aug 21, 2017
904f3ef
Fixup dockerfile
Aug 21, 2017
4871520
Rename test-app to reflect narrower scope
Aug 21, 2017
50cd172
Update readme
Aug 21, 2017
d8cc970
Bash quoting of arguments
Aug 22, 2017
4f67a24
Use timestamp instead of uuidgen
Aug 22, 2017
5f4c54f
Update readme with build statuses
Aug 22, 2017
e5c2a8b
Revert "Use timestamp instead of uuidgen"
Aug 22, 2017
c656640
Remove duplicated int test run through maven
Aug 22, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ services:
jdk:
- oraclejdk8

install: mvn dependency:resolve
# skip the install step
install: true
script: mvn --batch-mode clean verify

branches:
Expand Down
20 changes: 14 additions & 6 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,33 @@ To build the image you need git, docker (your user needs to be part of the ``doc
```
$ git clone https://github.com/GoogleCloudPlatform/openjdk-runtime.git
$ cd openjdk-runtime

# build all images
$ mvn clean install

# only build the openjdk:8 image
$ mvn clean install --also-make --projects openjdk8

# only build the openjdk:9 image
$ mvn clean install --also-make --projects openjdk9
```
The resulting image is called openjdk
These commands build the `openjdk` image with tags for each JDK version (`openjdk:8` and `openjdk:9`).

### Cloud build
To build using the [Google Cloud Container Builder](https://cloud.google.com/container-builder/docs/overview),
you need to have the [Google Cloud SDK](https://cloud.google.com/sdk/) installed locally. We provide a script to make this more convenient.
```
# the following commands will build and push an image named "gcr.io/my-project/openjdk:tag"
# the following commands will build and push an image named "gcr.io/my-project/openjdk:8"
$ PROJECT_ID=my-project
$ TAG=tag #optional
$ ./scripts/build.sh gcr.io/$PROJECT_ID $TAG
$ MODULE_TO_BUILD=openjdk8 # only builds the openjdk:8 image
$ ./scripts/build.sh -d gcr.io/$PROJECT_ID -m $MODULE_TO_BUILD
```

If you would like to simulate the cloud build locally, pass in the `--local` argument.
```
$ PROJECT_ID=my-project
$ TAG=tag #optional
$ ./scripts/build.sh gcr.io/$PROJECT_ID $TAG --local
$ MODULE_TO_BUILD=openjdk8 # only builds the openjdk:8 image
$ ./scripts/build.sh -d gcr.io/$PROJECT_ID -m $MODULE_TO_BUILD --local
```

# Running Tests
Expand Down
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
![Build Status](http://storage.googleapis.com/java-runtimes-kokoro-build-badges/openjdk-runtime-master.png)
![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.

This repository contains the source for the Google-maintained OpenJDK [docker](https://docker.com) image. This image can be used as the base image for running Java applications on [Google App Engine Flexible Environment](https://cloud.google.com/appengine/docs/flexible/java/) and [Google Container Engine](https://cloud.google.com/container-engine).

This image is mirrored at both `launcher.gcr.io/google/openjdk8` and `gcr.io/google-appengine/openjdk`.
## Repository/Tag Details
Supported images/tags include:
* `gcr.io/google-appengine/openjdk:8`, also mirrored at `launcher.gcr.io/google/openjdk8`
* `gcr.io/google-appengine/openjdk:9` (currently in beta)

## App Engine Flexible Environment
When using App Engine Flexible, you can use the runtime without worrying about Docker by specifying `runtime: java` in your `app.yaml`:
```yaml
runtime: java
env: flex
```
The runtime image `gcr.io/google-appenine/openjdk` will be automatically selected if you are attempting to deploy a JAR (`*.jar` file).
The runtime image `gcr.io/google-appenine/openjdk:8` will be automatically selected if you are attempting to deploy a JAR (`*.jar` file).

To select a jdk version, use the `runtime_config.jdk` field in app.yaml. Supported JDK versions include `openjdk8` and `openjdk9`.
```yaml
runtime: java
env: flex
runtime_config:
jdk: openjdk8
```

If you want to use the image as a base for a custom runtime, you can specify `runtime: custom` in your `app.yaml` and then
write the Dockerfile like this:
Expand Down
22 changes: 9 additions & 13 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@
# https://cloud.google.com/container-builder/docs/overview

steps:
# Build the maven project, omitting the docker build step
- name: 'gcr.io/cloud-builders/java/mvn:3.3.9-jdk-8'
args: ['-P-local-docker-build', '-Ddocker.tag.long=${_DOCKER_TAG}', 'clean', 'install']
id: 'MAVEN'
# Execute the docker build
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '--tag=${_IMAGE}', '--no-cache', 'openjdk8/target/docker']
id: 'DOCKER'

# Runtimes-common structure tests
# See https://github.com/GoogleCloudPlatform/runtimes-common/tree/master/structure_tests
- name: 'gcr.io/gcp-runtimes/structure_test'
args: ['--image', '${_IMAGE}', '-v', '--config', '/workspace/openjdk8/target/test-classes/structure.yaml']
id: 'STRUCTURE_TEST'
args:
- 'clean'
- 'install'
- '--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".

- '--also-make'
id: 'MVN_PACKAGE'

images: ['${_IMAGE}']
55 changes: 55 additions & 0 deletions openjdk-common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 Google Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.google.cloud.runtimes</groupId>
<artifactId>openjdk-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>Openjdk Common Docker Configuration</name>
<artifactId>openjdk-common</artifactId>
<packaging>pom</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<tarLongFileMode>gnu</tarLongFileMode>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
</project>
36 changes: 36 additions & 0 deletions openjdk-common/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--
~ Copyright 2017 Google Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>assembly</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>src/main/docker</baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<filtered>false</filtered>
<directory>src/main/docker</directory>
<outputDirectory></outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
is_true() {
# case insensitive check for "true"
if [[ ${1,,} = "true" ]]; then
return ${true}
true
else
return ${false}
false
fi
}
55 changes: 55 additions & 0 deletions openjdk-test-common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 Google Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.google.cloud.runtimes</groupId>
<artifactId>openjdk-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>Openjdk Common Test resources</name>
<artifactId>openjdk-test-common</artifactId>
<packaging>pom</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<tarLongFileMode>gnu</tarLongFileMode>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
</project>
36 changes: 36 additions & 0 deletions openjdk-test-common/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--
~ Copyright 2017 Google Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>assembly</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>src/test/resources</baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<filtered>false</filtered>
<directory>src/test/resources</directory>
<outputDirectory></outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,54 @@
schemaVersion: 1.0.0

commandTests:
- name: 'correct java version is installed'
command: ['java', '-version']
expectedError: ['openjdk version "1\.${openjdk.version.major}.*${openjdk.version.minor}"']
- name: 'ensure blacklisted packages are not installed as a dependency accidentally'
setup: [[ 'chmod', '+x', '/workspace/openjdk8/src/test/workspace/test-blacklisted-pkgs.bash' ]]
command: [ '/workspace/openjdk8/src/test/workspace/test-blacklisted-pkgs.bash' ]
excludedOutput: ['NOT OK.* is installed']
- name: 'correct javac version is installed'
command: ['javac', '-version']
expectedError: ['javac 1\.${openjdk.version.major}.*${openjdk.version.minor}']
- name: 'OPENJDK_VERSION env variable is set correctly'
command: ['env']
expectedOutput: ['OPENJDK_VERSION=${openjdk.version}']
- name: 'GAE_IMAGE_LABEL env variable is set correctly'
command: ['env']
expectedOutput: ['GAE_IMAGE_LABEL=${docker.tag.long}']
- name: 'check entrypoint default'
setup: [[ 'chmod', '+x', '/workspace/openjdk8/src/test/workspace/entrypoint-default.bash' ]]
command: [ '/workspace/openjdk8/src/test/workspace/entrypoint-default.bash' ]
setup: [[ 'chmod', '+x', '/workspace/entrypoint-default.bash' ]]
command: [ '/workspace/entrypoint-default.bash' ]
expectedOutput: ['OK']
exitCode: 0
- name: 'check entrypoint args only'
setup: [[ 'chmod', '+x', '/workspace/openjdk8/src/test/workspace/entrypoint-args-only.bash' ]]
command: [ '/workspace/openjdk8/src/test/workspace/entrypoint-args-only.bash' ]
setup: [[ 'chmod', '+x', '/workspace/entrypoint-args-only.bash' ]]
command: [ '/workspace/entrypoint-args-only.bash' ]
expectedOutput: ['OK']
exitCode: 0
- name: 'check entrypoint setup'
setup: [[ 'chmod', '+x', '/workspace/openjdk8/src/test/workspace/entrypoint-setup.bash' ]]
command: [ '/workspace/openjdk8/src/test/workspace/entrypoint-setup.bash' ]
setup: [[ 'chmod', '+x', '/workspace/entrypoint-setup.bash' ]]
command: [ '/workspace/entrypoint-setup.bash' ]
expectedOutput: ['OK']
exitCode: 0
- name: 'check setup platform'
setup: [[ 'chmod', '+x', '/workspace/openjdk8/src/test/workspace/setup-platform.bash' ]]
command: [ '/workspace/openjdk8/src/test/workspace/setup-platform.bash' ]
setup: [[ 'chmod', '+x', '/workspace/setup-platform.bash' ]]
command: [ '/workspace/setup-platform.bash' ]
expectedOutput: ['OK']
exitCode: 0
- name: 'check setup java'
setup: [[ 'chmod', '+x', '/workspace/openjdk8/src/test/workspace/setup-java.bash' ]]
command: [ '/workspace/openjdk8/src/test/workspace/setup-java.bash' ]
setup: [[ 'chmod', '+x', '/workspace/setup-java.bash' ]]
command: [ '/workspace/setup-java.bash' ]
expectedOutput: ['OK']
exitCode: 0
- name: 'check setup cloud debugger'
setup: [[ 'chmod', '+x', '/workspace/openjdk8/src/test/workspace/setup-debug.bash' ]]
command: [ '/workspace/openjdk8/src/test/workspace/setup-debug.bash' ]
setup: [[ 'chmod', '+x', '/workspace/setup-debug.bash' ]]
command: [ '/workspace/setup-debug.bash' ]
expectedOutput: ['OK']
exitCode: 0
- name: 'APP_DESTINATION env variable is set'
command: ['env']
expectedOutput: ['APP_DESTINATION=app.jar']
- name: 'check shutdown logging wrapper setup'
setup: [[ 'chmod', '+x', '/workspace/openjdk8/src/test/workspace/shutdown-env.bash' ]]
command: [ '/workspace/openjdk8/src/test/workspace/shutdown-env.bash' ]
setup: [[ 'chmod', '+x', '/workspace/shutdown-env.bash' ]]
command: [ '/workspace/shutdown-env.bash' ]
expectedOutput: ['OK']
exitCode: 0
- name: 'ensure blacklisted packages are not installed as a dependency accidentally'
setup: [[ 'chmod', '+x', '/workspace/test-blacklisted-pkgs.bash' ]]
command: [ '/workspace/test-blacklisted-pkgs.bash' ]
excludedOutput: ['NOT OK.* is installed']

fileExistenceTests:
- name: 'ssl certificates are present'
Expand Down
Loading