From 7a3dfa130a62ff17d6e70900d47cc94b672c2da8 Mon Sep 17 00:00:00 2001 From: Roy Golan Date: Thu, 13 Apr 2023 17:26:15 +0300 Subject: [PATCH] Migrate to Java 17 - No production code changes - Fix to an unreliable test - pom.xml changes for maven compiler plugin Signed-off-by: Roy Golan --- Makefile | 44 +++++++++++++++------------------ docs/README.md | 2 +- external-dependencies/pom.xml | 5 ---- notification-service/Dockerfile | 2 +- notification-service/pom.xml | 1 - pom.xml | 2 +- workflow-service/Dockerfile | 2 +- 7 files changed, 24 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 0b617dabb..dc8b5d6e3 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,9 @@ TESTDBUSER := parodos TESTDBPORT := 5432 # maven -MAVEN ?= mvn +MAVEN ?= /usr/bin/mvn # set quiet mode by default -Q=@ ORG=quay.io/parodos/ WORKFLOW_SERVICE_IMAGE=workflow-service @@ -23,36 +22,32 @@ VERSION = $(shell sed -n "s/\(.*\)<\/revision>/\1/p" $(PWD)/pom.xml | GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed s,^main$$,latest,g) GIT_HASH := $(shell git rev-parse HEAD) -JAVA_VERSION_MAX_SUPPORTED=11 -JAVA_VERSION_MIN_SUPPORTED=11 +MVN_JAVA_VERSION := $(shell $(MAVEN) --version | awk 'NR==3 { split($$3, ver, "."); print ver[1] }') +JAVA_VERSION := $(shell java --version | awk 'NR==1 { split($$2, ver, "."); print ver[1] }') +JAVA_VERSION_MAX_SUPPORTED=17 +JAVA_VERSION_MIN_SUPPORTED=17 + # Setting SHELL to bash allows bash commands to be executed by recipes. # This is a requirement for 'setup-envtest.sh' in the test target. # Options are set to exit when a recipe line exits non-zero or a piped command fails. SHELL = /usr/bin/env bash -o pipefail .SHELLFLAGS = -ec + mvn-checks: - # check if maven is installed - ifeq (,$(shell which $(MAVEN))) - $(error "No maven found in $(PATH). Please install maven") - else - MVN_JAVA_VERSION=$(shell mvn --version | sed -rn "s/.*Java version: ([[:digit:]]+)\.[[:digit:]]+\.[[:digit:]]+.*/\1/p") - MVN_VERSION_IS_SUPPORTED=$(shell [ $(MVN_JAVA_VERSION) -le $(JAVA_VERSION_MAX_SUPPORTED) ] && [ $(MVN_JAVA_VERSION) -ge $(JAVA_VERSION_MIN_SUPPORTED) ] && echo true) - ifeq ($(MVN_VERSION_IS_SUPPORTED), ) - $(error "Maven Java $(MVN_JAVA_VERSION) version should be [$(JAVA_VERSION_MIN_SUPPORTED) ; $(JAVA_VERSION_MAX_SUPPORTED)]. Please use Java within these bounds with mvn") - endif - endif + # check if maven is installed + @if [ -z $(MVN_JAVA_VERSION) ]; then echo "No maven found in $(PATH). Please install maven"; exit 1; fi + @if [ $(MVN_JAVA_VERSION) -lt $(JAVA_VERSION_MIN_SUPPORTED) ] || [ $(MVN_JAVA_VERSION) -gt $(JAVA_VERSION_MIN_SUPPORTED) ]; then \ + echo "Maven Java $(MVN_JAVA_VERSION) version should be [$(JAVA_VERSION_MIN_SUPPORTED) ; $(JAVA_VERSION_MAX_SUPPORTED)]. Please use Java within these bounds with mvn"; \ + exit 1; \ + fi java-checks: - # check java version - ifeq (,$(shell java --version)) - $(error "No java found in $(PATH). Please install java >= 11") - else - JAVA_VERSION=$(shell java --version | head -n 1 | sed -rn "s/.*\s([[:digit:]]+)\.[[:digit:]]+\.[[:digit:]]+\s.*/\1/p") - JAVA_VERSION_IS_SUPPORTED=$(shell [ $(JAVA_VERSION) -le $(JAVA_VERSION_MAX_SUPPORTED) ] && [ $(JAVA_VERSION) -ge $(JAVA_VERSION_MIN_SUPPORTED) ] && echo true) - ifeq ($(JAVA_VERSION_IS_SUPPORTED), ) - $(error "Java version $(JAVA_VERSION) should be [$(JAVA_VERSION_MIN_SUPPORTED) ; $(JAVA_VERSION_MAX_SUPPORTED)]. Please install Java within those bounds") - endif - endif + # check if Java is installed + @if [ -z $(JAVA_VERSION) ]; then echo "No java found in $(PATH). Please install java >= $(JAVA_VERSION_MIN_SUPPORTED)"; exit 1; fi + @if [ $(JAVA_VERSION) -lt $(JAVA_VERSION_MIN_SUPPORTED) ] || [ $(JAVA_VERSION) -gt $(JAVA_VERSION_MAX_SUPPORTED) ]; then \ + echo "Java version $(JAVA_VERSION) should be [$(JAVA_VERSION_MIN_SUPPORTED) ; $(JAVA_VERSION_MAX_SUPPORTED)]. Please install Java within those bounds"; \ + exit 1; \ + fi ##@ General @@ -203,3 +198,4 @@ run-postgres: # Run a sample postgres instance stop-postgres: $(DOCKER) rm -f parodos-postgres + diff --git a/docs/README.md b/docs/README.md index ab960ec64..db53e172d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,7 +11,7 @@ The following are the requirements to run the Parodos services. | nvm | For installing different tools | Please refer to the implemenation-examples/backstage folder | https://backstage.io/docs/getting-started/configuration | | yarn | For starting Backstage | Please refer to the implemenation-examples/backstage folder | | | Keycloak | All Parodos services integrate with it, it in turn can be integrated with different OAuth providers | 17.0+ | -| JDK | Required running the Parodos API | JDK/JVM 11 | At present JVM 11 seems to be the highest version of Java the clients running Parodos are approved to use. This can be updated on demand | +| JDK | Required running the Parodos API | JDK/JVM 17 | At present JVM 17 seems to be the highest version of Java the clients running Parodos are approved to use. This can be updated on demand | | Spring Boot | All of Parodos serivces (API, Standalone) are built with Spring Boot | 2.5.5 | This is only relevant for those looking change the Parodos code | | React | All of the Parodos services are written in React | 17.02 | The applications makes use of the Context for State and is styled with Material UI 4.12.4 | | Database (API layer) | Persistence API layer | Postgres 11.18+ | APIs use JPA and Liquid base to generate schemas. In theory they should work with most popular Database by changing the driver and recompiling the code. When starting any Parodos API in the 'local' profile, an H2 database is configured for evaluations | diff --git a/external-dependencies/pom.xml b/external-dependencies/pom.xml index 70e559277..3ac405717 100644 --- a/external-dependencies/pom.xml +++ b/external-dependencies/pom.xml @@ -11,11 +11,6 @@ external-dependencies - - 11 - 11 - UTF-8 - diff --git a/notification-service/Dockerfile b/notification-service/Dockerfile index 91db9078f..c61120046 100644 --- a/notification-service/Dockerfile +++ b/notification-service/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.access.redhat.com/ubi9/openjdk-11-runtime +FROM registry.access.redhat.com/ubi9/openjdk-17-runtime WORKDIR /app diff --git a/notification-service/pom.xml b/notification-service/pom.xml index 02a74193f..ec6dce3ce 100644 --- a/notification-service/pom.xml +++ b/notification-service/pom.xml @@ -23,7 +23,6 @@ http://github.com/parodos-dev/parodos/tree/main - 11 2020.0.6 1.6.4 5.4.0 diff --git a/pom.xml b/pom.xml index 24f110ff8..f3c944137 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ 1.0.8-SNAPSHOT 1.3.0 - 11 + 17 UTF-8 3.8.1 2.5.3 diff --git a/workflow-service/Dockerfile b/workflow-service/Dockerfile index ffc4dd062..3ab6a817a 100644 --- a/workflow-service/Dockerfile +++ b/workflow-service/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.access.redhat.com/ubi9/openjdk-11-runtime +FROM registry.access.redhat.com/ubi9/openjdk-17-runtime WORKDIR /app