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

Move 1.3 to Java 11 by default #8153

Merged
merged 9 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 25 additions & 29 deletions .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ on:
env:
# Workaround testsuite locale issue
LANG: en_US.UTF-8
NATIVE_TEST_MAVEN_OPTS: "-B --settings azure-mvn-settings.xml -Dquarkus.native.container-build=true -Dtest-postgresql -Dtest-elasticsearch -Dtest-keycloak -Dtest-dynamodb -Dtest-mysql -Dtest-mariadb -Dmariadb.url='jdbc:mariadb://localhost:3308/hibernate_orm_test' -Dtest-mssql -Dtest-vault -Dtest-neo4j -Dnative-image.xmx=6g -Dnative -Dno-format install"
NATIVE_TEST_MAVEN_OPTS: "-B --settings azure-mvn-settings.xml -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:19.3.1-java11 -Dtest-postgresql -Dtest-elasticsearch -Dtest-keycloak -Dtest-dynamodb -Dtest-mysql -Dtest-mariadb -Dmariadb.url='jdbc:mariadb://localhost:3308/hibernate_orm_test' -Dtest-mssql -Dtest-vault -Dtest-neo4j -Dnative-image.xmx=5g -Dnative -Dno-format install"
JVM_TEST_MAVEN_OPTS: "-e -B --settings azure-mvn-settings.xml -Dtest-postgresql -Dtest-elasticsearch -Dtest-mysql -Dtest-mariadb -Dmariadb.url='jdbc:mariadb://localhost:3308/hibernate_orm_test' -Dtest-mssql -Dtest-dynamodb -Dtest-vault -Dtest-neo4j -Dtest-keycloak -Dno-format"
DB_USER: hibernate_orm_test
DB_PASSWORD: hibernate_orm_test
DB_NAME: hibernate_orm_test
jobs:
build-jdk8:
name: "JDK 8 Build"
build-jdk11:
name: "JDK 11 Build"
runs-on: ubuntu-latest
# Skip draft PRs and those with WIP in the subject, rerun as soon as its removed
if: "github.event_name != 'pull_request' || ( \
Expand All @@ -60,11 +60,11 @@ jobs:
- uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK 8
- name: Set up JDK 11
# Uses sha for added security since tags can be updated
uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9
with:
java-version: openjdk8
java-version: openjdk11
- name: Compute cache restore key
# Always recompute on a push so that the maven repo doesnt grow indefinitely with old versions
run: |
Expand All @@ -89,14 +89,10 @@ jobs:
with:
name: maven-repo
path: maven-repo.tgz
- name: Cleanup Cache
shell: bash
run: |
find ~/.m2/repositoiry/io/quarkus/ -mindepth 1 -maxdepth 1 \( ! -name http -a ! -name gizmo -a ! -name security \) -exec echo {} \; -exec rm -rf {} \; || true

linux-jvm-tests:
name: JDK ${{matrix.java-version}} JVM Tests
needs: build-jdk8
needs: build-jdk11
timeout-minutes: 120
strategy:
fail-fast: ${{ github.repository == 'quarkusio/quarkus' }}
Expand Down Expand Up @@ -185,21 +181,21 @@ jobs:
name: test-reports-linux-jvm${{matrix.java-version}}
path: 'test-reports.tgz'

windows-jdk8-jvm-tests:
name: Windows JDK 8 JVM Tests
needs: build-jdk8
windows-jdk11-jvm-tests:
name: Windows JDK 11 JVM Tests
needs: build-jdk11
runs-on: windows-latest
timeout-minutes: 120
env:
MAVEN_OPTS: -Xmx1408m

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
# Uses sha for added security since tags can be updated
uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9
with:
java-version: openjdk8
java-version: openjdk11
- name: Download Maven Repo
uses: actions/download-artifact@v1
with:
Expand All @@ -221,12 +217,12 @@ jobs:
uses: actions/upload-artifact@v1
if: failure()
with:
name: test-reports-windows-jdk8-jvm
name: test-reports-windows-jdk11-jvm
path: 'test-reports.tgz'

tcks-test:
name: TCKS Test
needs: build-jdk8
needs: build-jdk11
runs-on: ubuntu-latest
timeout-minutes: 120

Expand Down Expand Up @@ -259,11 +255,11 @@ jobs:
sudo service mysql stop || true
docker run --rm --publish 3306:3306 --name build-mysql -e MYSQL_USER=$DB_USER -e MYSQL_PASSWORD=$DB_PASSWORD -e MYSQL_DATABASE=$DB_NAME -e MYSQL_RANDOM_ROOT_PASSWORD=true -e MYSQL_DATABASE=hibernate_orm_test -d mysql:5 --skip-ssl
- uses: actions/checkout@v2
- name: Set up JDK 8
- name: Set up JDK 11
# Uses sha for added security since tags can be updated
uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9
with:
java-version: openjdk8
java-version: openjdk11
- name: Download Maven Repo
uses: actions/download-artifact@v1
with:
Expand All @@ -289,7 +285,7 @@ jobs:

native-tests:
name: Native Tests - ${{matrix.category}}
needs: build-jdk8
needs: build-jdk11
runs-on: ubuntu-latest
# Ignore the following YAML Schema error
timeout-minutes: ${{matrix.timeout}}
Expand All @@ -301,7 +297,7 @@ jobs:
include:
- category: Main
postgres: "true"
timeout: 25
timeout: 30
test-modules: main
- category: Data1
mariadb: "true"
Expand All @@ -316,7 +312,7 @@ jobs:
- category: Data2
mysql: "true"
postgres: "true"
timeout: 25
timeout: 30
test-modules: >
jpa
jpa-postgresql
Expand All @@ -338,14 +334,14 @@ jobs:
mongodb-panache
neo4j
- category: Data5
timeout: 25
timeout: 30
test-modules: >
hibernate-search-elasticsearch
narayana-stm
narayana-jta
- category: Amazon
dynamodb: "true"
timeout: 15
timeout: 20
test-modules: >
amazon-dynamodb
amazon-lambda
Expand All @@ -358,7 +354,7 @@ jobs:
kafka
kafka-streams
- category: Security1
timeout: 20
timeout: 30
keycloak: "true"
test-modules: >
elytron-security-oauth2
Expand Down Expand Up @@ -410,9 +406,9 @@ jobs:
logging-gelf
bootstrap-config
optaplanner-jackson
# kubernetes-client alone takes 16mn+
# kubernetes-client alone takes 30mn+
- category: Misc3
timeout: 35
timeout: 50
test-modules: >
kogito
kubernetes-client
Expand Down Expand Up @@ -472,11 +468,11 @@ jobs:
-d quay.io/keycloak/keycloak:9.0.0
if: matrix.keycloak
- uses: actions/checkout@v2
- name: Set up JDK 8
- name: Set up JDK 11
# Uses sha for added security since tags can be updated
uses: joschi/setup-jdk@7134ae95986e4e0a4f9f0b51345c93fcebfc4ea9
with:
java-version: openjdk8
java-version: openjdk11
- name: Download Maven Repo
uses: actions/download-artifact@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/native-cron-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Quarkus Cron Native image"
name: "Quarkus CI - JDK 8 Native Build"
on:
schedule:
- cron: '0 2 * * *'
Expand All @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
java: [ 11 ]
java: [ 8 ]
name: build-and-testing
steps:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public class NativeConfig {
/**
* The docker image to use to do the image build
*/
@ConfigItem(defaultValue = "quay.io/quarkus/ubi-quarkus-native-image:19.3.1-java8")
@ConfigItem(defaultValue = "quay.io/quarkus/ubi-quarkus-native-image:19.3.1-java11")
public String builderImage;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,12 @@ group '${project_groupId}'
version '${project_version}'

compileScala {
scalaCompileOptions.encoding = 'UTF-8'
scalaCompileOptions.encoding = 'UTF-8'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
1 change: 1 addition & 0 deletions docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<quarkus-version>${project.version}</quarkus-version>
<surefire-version>${version.surefire.plugin}</surefire-version>
<graalvm-version>${graal-sdk.version-for-documentation}</graalvm-version>
<graalvm-flavor>${graal-sdk.version-for-documentation}-java11</graalvm-flavor>
<restassured-version>${rest-assured.version}</restassured-version>
<maven-version>${proposed-maven-version}</maven-version>
<gradle-version>${gradle-wrapper.version}</gradle-version>
Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ complete list of externalized variables for use is given in the following table:
|\{quickstarts-blob-url}|{quickstarts-blob-url}| Quickstarts URL to master blob source tree; used for referencing source files.
|\{quickstarts-tree-url}|{quickstarts-tree-url}| Quickstarts URL to master source tree root; used for referencing directories.

|\{graalvm-version}|{graalvm-version}| Recommended Graal VM version to use.
|\{graalvm-version}|{graalvm-version}| Recommended GraalVM version to use.
|\{graalvm-flavor}|{graalvm-flavor}| The full flavor of GraaVM to use e.g. `19.3.1-java11`.
|===
4 changes: 1 addition & 3 deletions docs/src/main/asciidoc/building-native-image.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ In this guide we will use the first stage to generate the native executable usin
[source,dockerfile,subs=attributes+]
----
## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/centos-quarkus-maven:{graalvm-version}-java8 AS build
FROM quay.io/quarkus/centos-quarkus-maven:{graalvm-flavor} AS build
COPY src /usr/src/app/src
COPY pom.xml /usr/src/app
USER root
Expand All @@ -392,8 +392,6 @@ Save this file in `src/main/docker/Dockerfile.multistage` as it is not included

[WARNING]
====
Replace the -java8 in the base image with -java11 if you want to use Java 11.

Before launching our Docker build, we need to update the default `.dockerignore` file as it filters everything except the `target` directory and as we plan to build inside a container we need to be able to copy the `src` directory. So edit your `.dockerignore` and remove or comment its content.
====

Expand Down
12 changes: 2 additions & 10 deletions docs/src/main/asciidoc/deploying-to-openshift-s2i.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ We are going to create an OpenShift `build` executing it:
[source,shell, subs="attributes"]
----
# To build the image on OpenShift
oc new-app quay.io/quarkus/ubi-quarkus-native-s2i:{graalvm-version}-java8~{quickstarts-clone-url} --context-dir=getting-started --name=quarkus-quickstart-native
oc new-app quay.io/quarkus/ubi-quarkus-native-s2i:{graalvm-flavor}~{quickstarts-clone-url} --context-dir=getting-started --name=quarkus-quickstart-native
oc logs -f bc/quarkus-quickstart-native

# To create the route
Expand All @@ -49,12 +49,6 @@ echo $URL
curl $URL/hello/greeting/quarkus
----

[TIP]
====
The `oc new-app` command above uses a builder image compatible with JDK 8.
In order to create a JDK 11 native compatible image use `quay.io/quarkus/ubi-quarkus-native-s2i:{graalvm-version}-java11` as a builder image.
====

Your application is accessible at the printed URL.

Note that GraalVM-based native build are more memory & CPU intensive than regular pure Java builds.
Expand Down Expand Up @@ -117,11 +111,9 @@ The end result is an image that is less than 40 MB in size (compressed) and does
The minimal build is depending on the S2I build since it is using the output (native runnable application) from the S2I build. However, you do not need to create an application with `oc new-app`. Instead you could use `oc new-build` like this:
[source, shell, subs="attributes"]
----
oc new-build quay.io/quarkus/ubi-quarkus-native-s2i:{graalvm-version}-java8~{quickstarts-clone-url} \
oc new-build quay.io/quarkus/ubi-quarkus-native-s2i:{graalvm-flavor}~{quickstarts-clone-url} \
--context-dir=getting-started --name=quarkus-quickstart-native
----

Like in previous commands, use `quay.io/quarkus/ubi-quarkus-native-s2i:{graalvm-version}-java11` for building a JDK 11 compatible image.
====

== Deploying the application as Java application in OpenShift
Expand Down
9 changes: 7 additions & 2 deletions docs/src/main/asciidoc/gradle-tooling.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,13 @@ Note that in this case the build itself runs in a Docker container too, so you d

[TIP]
====
By default, the native image will be generated using the `quay.io/quarkus/ubi-quarkus-native-image:{graalvm-version}-java8` Docker image which is only compatible with JDK 8.
If you want to build a native image compatible with JDK 11, you will have to use the `-Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:{graalvm-version}-java11` build argument.
By default, the native executable will be generated using the `quay.io/quarkus/ubi-quarkus-native-image:{graalvm-flavor}` Docker image.

If you want to build a native executable with a different Docker image (for instance to use a different GraalVM version),
use the `-Dquarkus.native.builder-image=<image name>` build argument.

The list of the available Docker images can be found on https://quay.io/repository/quarkus/ubi-quarkus-native-image?tab=tags[quay.io].
Be aware that a given Quarkus version might not be compatible with all the images available.
====

Another way of customizing the native build image build process is to configure the task inside the Gradle build script. If for example it is required to set the `enableHttpUrlHandler`, it can be done like so:
Expand Down
9 changes: 7 additions & 2 deletions docs/src/main/asciidoc/maven-tooling.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,13 @@ Note that in this case the build itself runs in a Docker container too, so you d

[TIP]
====
By default, the native image will be generated using the `quay.io/quarkus/ubi-quarkus-native-image:{graalvm-version}-java8` Docker image which is only compatible with JDK 8.
If you want to build a native image compatible with JDK 11, you will have to use the `-Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:{graalvm-version}-java11` build argument.
By default, the native executable will be generated using the `quay.io/quarkus/ubi-quarkus-native-image:{graalvm-flavor}` Docker image.

If you want to build a native executable with a different Docker image (for instance to use a different GraalVM version),
use the `-Dquarkus.native.builder-image=<image name>` build argument.

The list of the available Docker images can be found on https://quay.io/repository/quarkus/ubi-quarkus-native-image?tab=tags[quay.io].
Be aware that a given Quarkus version might not be compatible with all the images available.
====

You can follow the link:building-native-image[Build a native executable guide] as well as link:deploying-to-kubernetes[Deploying Application to Kubernetes and OpenShift] for more information.
Expand Down
37 changes: 13 additions & 24 deletions docs/src/main/asciidoc/native-and-ssl.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -199,42 +199,31 @@ Don't forget to move your GraalVM directory back to where it was.

=== Working with containers

When working with containers, the idea is to bundle both the SunEC library and the certificates in the container and to point your binary to them using the system properties mentioned above.
When working with containers, the idea is to bundle the certificates in the container and to point your binary to them using the system property mentioned above.

You can for example modify your `Dockerfile.native` as follows to copy the required files to your final image:

==== Java 8
[source, subs=attributes+]
----
FROM quay.io/quarkus/ubi-quarkus-native-image:{graalvm-version}-java8 as nativebuilder
RUN mkdir -p /tmp/ssl-libs/lib \
&& cp /opt/graalvm/jre/lib/security/cacerts /tmp/ssl-libs \
&& cp /opt/graalvm/jre/lib/amd64/libsunec.so /tmp/ssl-libs/lib/
FROM quay.io/quarkus/ubi-quarkus-native-image:{graalvm-flavor} as nativebuilder
RUN mkdir -p /tmp/ssl \
&& cp /opt/graalvm/lib/security/cacerts /tmp/ssl/

FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY --from=nativebuilder /tmp/ssl-libs/ /work/
COPY --from=nativebuilder /tmp/ssl/ /work/
COPY target/*-runner /work/application
RUN chmod 775 /work /work/application
EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0", "-Djava.library.path=/work/lib", "-Djavax.net.ssl.trustStore=/work/cacerts"]
----

==== Java 11
[source, subs=attributes+]
----
FROM quay.io/quarkus/ubi-quarkus-native-image:{graalvm-version}-java11 as nativebuilder
RUN mkdir -p /tmp/ssl-libs/lib \
&& cp /opt/graalvm/lib/security/cacerts /tmp/ssl-libs \
&& cp /opt/graalvm/lib/libsunec.so /tmp/ssl-libs/lib/
# set up permissions for user `1001`
RUN chmod 775 /work /work/application \
&& chown -R 1001 /work \
&& chmod -R "g+rwX" /work \
&& chown -R 1001:root /work

FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY --from=nativebuilder /tmp/ssl-libs/ /work/
COPY target/*-runner /work/application
RUN chmod 775 /work /work/application
EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0", "-Djava.library.path=/work/lib", "-Djavax.net.ssl.trustStore=/work/cacerts"]
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0", "-Djavax.net.ssl.trustStore=/work/cacerts"]
----

== Conclusion
Expand Down
Loading