From b42f523be24e154260a471143516778060a7566b Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Thu, 31 Oct 2024 09:54:06 +0100 Subject: [PATCH 01/32] Sync upstream --- .../software/xdev/tci/demo/Application.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/Application.java b/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/Application.java index b98cabc..3f7f67c 100644 --- a/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/Application.java +++ b/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/Application.java @@ -1,6 +1,8 @@ package software.xdev.tci.demo; -import java.util.Optional; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -14,12 +16,15 @@ public static void main(final String[] args) { System.setProperty( "spring.config.additional-location", - "optional:" - + "classpath:/application-add.yml," - + "classpath:/application-add-log.yml" - + Optional.ofNullable(System.getProperty("spring.config.additional-location")) - .map(s -> "," + s) - .orElse("")); + Stream.of( + "optional:classpath:/application-add.yml", + "classpath:/application-add-log.yml", + System.getProperty("spring.config.additional-location"), + // [Deployment] Also consider ENV variable since it has a lower priority and is otherwise ignored + // See https://docs.spring.io/spring-boot/reference/features/external-config.html + System.getenv("SPRING_CONFIG_ADDITIONAL-LOCATION")) + .filter(Objects::nonNull) + .collect(Collectors.joining(","))); SpringApplication.run(Application.class, args); } } From 71f1b1dab2fbc93df1efd3870c88ea14f82de9d5 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Fri, 1 Nov 2024 02:39:13 +0000 Subject: [PATCH 02/32] Update dependency com.puppycrawl.tools:checkstyle to v10.20.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a62886a..8e85bad 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.19.0</version> + <version>10.20.0</version> </dependency> </dependencies> <configuration> diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 454ddcc..08cadb5 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.19.0</version> + <version>10.20.0</version> </dependency> </dependencies> <configuration> From d7b7b8a7dc4f464a641062cd3ff41b9af4394302 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Sun, 3 Nov 2024 02:38:33 +0000 Subject: [PATCH 03/32] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.11.1 --- template-placeholder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 454ddcc..e1b6b3c 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -143,7 +143,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>3.10.1</version> + <version>3.11.1</version> <executions> <execution> <id>attach-javadocs</id> From 9db65aa7fecf7cec0a0c54455de8b1af15ebabf1 Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Mon, 4 Nov 2024 10:38:51 +0100 Subject: [PATCH 04/32] Demo: Improve SHA256 hashing --- .../software/xdev/tci/demo/security/OtherWebSecurity.java | 4 ++-- .../main/java/software/xdev/tci/demo/util/SHA256Hashing.java | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/security/OtherWebSecurity.java b/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/security/OtherWebSecurity.java index ac51069..deca053 100644 --- a/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/security/OtherWebSecurity.java +++ b/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/security/OtherWebSecurity.java @@ -99,13 +99,13 @@ private AuthenticationProvider getActuatorAuthProvider() @Override public boolean matches(final CharSequence rawPassword, final String encodedPassword) { - if(rawPassword == null || rawPassword.isEmpty() || !pwHash.equals(encodedPassword)) + if(rawPassword == null || rawPassword.isEmpty() || rawPassword.length() > 1000) { OtherWebSecurity.this.actuatorLoginFailed.increment(); return false; } - final boolean success = SHA256Hashing.hash(rawPassword.toString()).equals(encodedPassword); + final boolean success = SHA256Hashing.hash(rawPassword.toString()).equals(pwHash); if(success) { OtherWebSecurity.this.actuatorLoginSuccess.increment(); diff --git a/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/util/SHA256Hashing.java b/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/util/SHA256Hashing.java index ce3d7d8..506a686 100644 --- a/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/util/SHA256Hashing.java +++ b/tci-advanced-demo/webapp/src/main/java/software/xdev/tci/demo/util/SHA256Hashing.java @@ -7,7 +7,6 @@ public final class SHA256Hashing { - private static final String SHA_256 = "SHA-256"; private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray(); @@ -16,6 +15,9 @@ private SHA256Hashing() { } + /** + * @apiNote Note that SHA256 gets slower the longer the input is. Ensure that the input length is limited. + */ @SuppressWarnings("checkstyle:MagicNumber") public static String hash(final String input) { From d7926e6ce40ec7ee03e218a4eb8433b15d6c1c7e Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Fri, 8 Nov 2024 02:32:23 +0000 Subject: [PATCH 05/32] Update dependency com.puppycrawl.tools:checkstyle to v10.20.1 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8e85bad..d069dc6 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.0</version> + <version>10.20.1</version> </dependency> </dependencies> <configuration> diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e595715..2155875 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.0</version> + <version>10.20.1</version> </dependency> </dependencies> <configuration> From 8d16f5b86c6eb6a269cddd1fa31671f920a90c94 Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Mon, 11 Nov 2024 08:55:26 +0100 Subject: [PATCH 06/32] Update CheckStyle version --- .idea/checkstyle-idea.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index eb3fcd8..5f35e01 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="CheckStyle-IDEA" serialisationVersion="2"> - <checkstyleVersion>10.15.0</checkstyleVersion> + <checkstyleVersion>10.20.1</checkstyleVersion> <scanScope>JavaOnlyWithTests</scanScope> <suppressErrors>true</suppressErrors> <copyLibs>true</copyLibs> From 73b7fed94cb6e91326149d6b90c7711ca23a5f78 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Mon, 18 Nov 2024 07:49:41 +0000 Subject: [PATCH 07/32] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.2 --- tci-advanced-demo/pom.xml | 2 +- tci-base-demo/pom.xml | 2 +- tci-base/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 4706ef7..f66a9e8 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -205,7 +205,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>3.5.1</version> + <version>3.5.2</version> </plugin> <plugin> diff --git a/tci-base-demo/pom.xml b/tci-base-demo/pom.xml index a73b9b8..54fdcd3 100644 --- a/tci-base-demo/pom.xml +++ b/tci-base-demo/pom.xml @@ -69,7 +69,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>3.5.1</version> + <version>3.5.2</version> <configuration> <!-- Test need to be executed individually --> <skipTests>true</skipTests> diff --git a/tci-base/pom.xml b/tci-base/pom.xml index e1fa448..81b8fc1 100644 --- a/tci-base/pom.xml +++ b/tci-base/pom.xml @@ -220,7 +220,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>3.5.1</version> + <version>3.5.2</version> </plugin> </plugins> </build> From 4636922f55bd645e66d7acc26c47edbad314bac6 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Mon, 18 Nov 2024 07:49:42 +0000 Subject: [PATCH 08/32] Update dependency com.puppycrawl.tools:checkstyle to v10.20.1 --- tci-advanced-demo/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 4706ef7..3ccb037 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -264,7 +264,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.19.0</version> + <version>10.20.1</version> </dependency> </dependencies> <configuration> From 035ec127736043edf43c4c0cb72dc47fc6c1fe9e Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Mon, 18 Nov 2024 07:49:46 +0000 Subject: [PATCH 09/32] Update dependency org.seleniumhq.selenium:selenium-dependencies-bom to v4.26.0 --- tci-advanced-demo/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 4706ef7..48fd84a 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -99,7 +99,7 @@ <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-dependencies-bom</artifactId> - <version>4.25.0</version> + <version>4.26.0</version> <type>pom</type> <scope>import</scope> </dependency> From 8db7abdb90fae7411765c896600323d940b8e268 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Thu, 21 Nov 2024 02:38:05 +0000 Subject: [PATCH 10/32] Update dependency org.mariadb.jdbc:mariadb-java-client to v3.5.1 --- tci-advanced-demo/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 4706ef7..d3546b9 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -154,7 +154,7 @@ <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> - <version>3.5.0</version> + <version>3.5.1</version> <!-- https://mariadb.com/kb/en/about-mariadb-connector-j/#size-consideration --> <exclusions> <exclusion> From eecded7d58e7e7cf27a3abd99f17213a0dbd0716 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Thu, 21 Nov 2024 02:38:08 +0000 Subject: [PATCH 11/32] Update org.testcontainers to v1.20.4 --- tci-advanced-demo/pom.xml | 2 +- tci-base/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 4706ef7..1a0c3c1 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -145,7 +145,7 @@ <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers-bom</artifactId> - <version>1.20.3</version> + <version>1.20.4</version> <type>pom</type> <scope>import</scope> </dependency> diff --git a/tci-base/pom.xml b/tci-base/pom.xml index e1fa448..ca19bd9 100644 --- a/tci-base/pom.xml +++ b/tci-base/pom.xml @@ -95,7 +95,7 @@ <groupId>org.testcontainers</groupId> <artifactId>testcontainers</artifactId> <scope>compile</scope> - <version>1.20.3</version> + <version>1.20.4</version> <exclusions> <!-- The few classes that testcontainers needs have been extracted --> <exclusion> From d12ec222a2886eae2ba545ce8f58f27e01bb99f8 Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Fri, 22 Nov 2024 13:22:07 +0100 Subject: [PATCH 12/32] Generate sources and javadoc during package and not verify This should prevent javadoc problems during release or similar situations --- template-placeholder/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 2155875..3a5bc8e 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -147,7 +147,7 @@ <executions> <execution> <id>attach-javadocs</id> - <phase>verify</phase> + <phase>package</phase> <goals> <goal>jar</goal> </goals> @@ -165,7 +165,7 @@ <executions> <execution> <id>attach-sources</id> - <phase>verify</phase> + <phase>package</phase> <goals> <goal>jar-no-fork</goal> </goals> From 2ec98d3be8a62afc571859f21eb96015ac636bc2 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Sat, 30 Nov 2024 02:36:45 +0000 Subject: [PATCH 13/32] Update net.sourceforge.pmd to v7.8.0 --- pom.xml | 4 ++-- template-placeholder/pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index d069dc6..0c03cd5 100644 --- a/pom.xml +++ b/pom.xml @@ -82,12 +82,12 @@ <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-core</artifactId> - <version>7.7.0</version> + <version>7.8.0</version> </dependency> <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-java</artifactId> - <version>7.7.0</version> + <version>7.8.0</version> </dependency> </dependencies> </plugin> diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 3a5bc8e..2269f3f 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -284,12 +284,12 @@ <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-core</artifactId> - <version>7.7.0</version> + <version>7.8.0</version> </dependency> <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-java</artifactId> - <version>7.7.0</version> + <version>7.8.0</version> </dependency> </dependencies> </plugin> From 6b853f13e48fc5e15d102f56523929a7f1ffd22a Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Sun, 1 Dec 2024 02:47:14 +0000 Subject: [PATCH 14/32] Update dependency com.puppycrawl.tools:checkstyle to v10.20.2 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d069dc6..5068c8f 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.1</version> + <version>10.20.2</version> </dependency> </dependencies> <configuration> diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 3a5bc8e..8a9db79 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.1</version> + <version>10.20.2</version> </dependency> </dependencies> <configuration> From 07c48c88ff590329bd1a38e2a384845a71ad5791 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Sun, 8 Dec 2024 02:43:59 +0000 Subject: [PATCH 15/32] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.11.2 --- template-placeholder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 9ac769d..abbbb53 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -143,7 +143,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>3.11.1</version> + <version>3.11.2</version> <executions> <execution> <id>attach-javadocs</id> From 94e21493243c3cc4812c260af202249351c15fd1 Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Mon, 9 Dec 2024 09:27:36 +0100 Subject: [PATCH 16/32] Remove duplicated save action Does the same/less as ``localCanBeFinal`` --- .idea/saveactions_settings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/.idea/saveactions_settings.xml b/.idea/saveactions_settings.xml index 506f17e..848c311 100644 --- a/.idea/saveactions_settings.xml +++ b/.idea/saveactions_settings.xml @@ -9,7 +9,6 @@ <option value="reformatChangedCode" /> <option value="fieldCanBeFinal" /> <option value="localCanBeFinal" /> - <option value="localCanBeFinalExceptImplicit" /> <option value="unqualifiedFieldAccess" /> <option value="unqualifiedMethodAccess" /> <option value="missingOverrideAnnotation" /> From 449108446709209eaa9acab0b898f6eb69c964f7 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Mon, 9 Dec 2024 14:08:59 +0000 Subject: [PATCH 17/32] Update net.sourceforge.pmd to v7.8.0 --- tci-advanced-demo/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 58e7966..432d358 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -304,12 +304,12 @@ <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-core</artifactId> - <version>7.7.0</version> + <version>7.8.0</version> </dependency> <dependency> <groupId>net.sourceforge.pmd</groupId> <artifactId>pmd-java</artifactId> - <version>7.7.0</version> + <version>7.8.0</version> </dependency> </dependencies> </plugin> From 105d452ff8d65ced9a981a00dfb6ad8332dfcfd2 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Fri, 13 Dec 2024 02:41:05 +0000 Subject: [PATCH 18/32] Update dependency com.puppycrawl.tools:checkstyle to v10.21.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index eede261..eac619a 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.2</version> + <version>10.21.0</version> </dependency> </dependencies> <configuration> diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index abbbb53..75f0b85 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.2</version> + <version>10.21.0</version> </dependency> </dependencies> <configuration> From 4ff942d7bb0f3940bd38c6b4120718063898096f Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Fri, 13 Dec 2024 02:41:12 +0000 Subject: [PATCH 19/32] Update dependency com.puppycrawl.tools:checkstyle to v10.21.0 --- pom.xml | 2 +- tci-advanced-demo/pom.xml | 2 +- tci-base/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 79564f3..1ec5cee 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.2</version> + <version>10.21.0</version> </dependency> </dependencies> <configuration> diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 58e7966..4d9158a 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -264,7 +264,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.1</version> + <version>10.21.0</version> </dependency> </dependencies> <configuration> diff --git a/tci-base/pom.xml b/tci-base/pom.xml index df82022..1951235 100644 --- a/tci-base/pom.xml +++ b/tci-base/pom.xml @@ -310,7 +310,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>10.20.2</version> + <version>10.21.0</version> </dependency> </dependencies> <configuration> From 02e4885dd7782e23d85f4c70c7d3cc9ff2d92060 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Mon, 16 Dec 2024 07:43:39 +0000 Subject: [PATCH 20/32] Update dependency org.seleniumhq.selenium:selenium-dependencies-bom to v4.27.0 --- tci-advanced-demo/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 44d9bce..90d030e 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -99,7 +99,7 @@ <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-dependencies-bom</artifactId> - <version>4.26.0</version> + <version>4.27.0</version> <type>pom</type> <scope>import</scope> </dependency> From 73b158a40c742e4ff95de2770f2c5f298c96324c Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Mon, 16 Dec 2024 09:06:51 +0100 Subject: [PATCH 21/32] Update to latest checkstyle version --- .idea/checkstyle-idea.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index 5f35e01..b52c3e2 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="CheckStyle-IDEA" serialisationVersion="2"> - <checkstyleVersion>10.20.1</checkstyleVersion> + <checkstyleVersion>10.21.0</checkstyleVersion> <scanScope>JavaOnlyWithTests</scanScope> <suppressErrors>true</suppressErrors> <copyLibs>true</copyLibs> From f5ec60789e001a7de67241599f15d32b78c669e5 Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Tue, 17 Dec 2024 08:39:27 +0100 Subject: [PATCH 22/32] [Renovate] Group junit --- renovate.json5 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/renovate.json5 b/renovate.json5 index a6422f9..146e1e3 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -53,6 +53,17 @@ "maven" ], "groupName": "org.testcontainers" + }, + { + "description": "Group org.junit", + "matchPackagePatterns": [ + "^org.junit:junit-bom", + "^org.junit.jupiter" + ], + "datasources": [ + "maven" + ], + "groupName": "org.junit" } ] } From bfe87cd887bccd1e20f5ef03708bc77d07b398c3 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Tue, 17 Dec 2024 07:42:03 +0000 Subject: [PATCH 23/32] Update dependency org.junit.platform:junit-platform-launcher to v1.11.4 --- tci-base/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tci-base/pom.xml b/tci-base/pom.xml index 2a86d6c..c1aa879 100644 --- a/tci-base/pom.xml +++ b/tci-base/pom.xml @@ -116,7 +116,7 @@ <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> <scope>compile</scope> - <version>1.11.3</version> + <version>1.11.4</version> </dependency> <!-- Tests --> From a245ceb521e3e898723cd4be556fc2f8d504d10c Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Tue, 17 Dec 2024 07:42:10 +0000 Subject: [PATCH 24/32] Update org.junit to v5.11.4 --- tci-advanced-demo/pom.xml | 2 +- tci-base-demo/pom.xml | 2 +- tci-base/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 90d030e..971a436 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -121,7 +121,7 @@ <dependency> <groupId>org.junit</groupId> <artifactId>junit-bom</artifactId> - <version>5.11.3</version> + <version>5.11.4</version> <type>pom</type> <scope>import</scope> </dependency> diff --git a/tci-base-demo/pom.xml b/tci-base-demo/pom.xml index 54fdcd3..bce738d 100644 --- a/tci-base-demo/pom.xml +++ b/tci-base-demo/pom.xml @@ -38,7 +38,7 @@ <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> - <version>5.11.3</version> + <version>5.11.4</version> <scope>test</scope> </dependency> diff --git a/tci-base/pom.xml b/tci-base/pom.xml index 2a86d6c..f422066 100644 --- a/tci-base/pom.xml +++ b/tci-base/pom.xml @@ -123,7 +123,7 @@ <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> - <version>5.11.3</version> + <version>5.11.4</version> <scope>test</scope> </dependency> </dependencies> From 684e96920be0c663e5fc4bbf72d0ad84c8d2fd03 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Tue, 17 Dec 2024 07:42:17 +0000 Subject: [PATCH 25/32] Update dependency org.springdoc:springdoc-openapi-starter-webmvc-ui to v2.7.0 --- tci-advanced-demo/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 90d030e..4d630f9 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -113,7 +113,7 @@ <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> - <version>2.6.0</version> + <version>2.7.0</version> </dependency> <!-- Tests --> From 74678bb41620f23c107d8db700fbb1aa6b81e6c8 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot <renovate@xdev-software.de> Date: Tue, 17 Dec 2024 07:42:23 +0000 Subject: [PATCH 26/32] Update org.springframework.boot.version to v3.4.0 --- tci-advanced-demo/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 90d030e..ac171a6 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -21,7 +21,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <org.springframework.boot.version>3.3.5</org.springframework.boot.version> + <org.springframework.boot.version>3.4.0</org.springframework.boot.version> </properties> <modules> From 34888792d453e034ada82cc6604c468f476f01bc Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Tue, 17 Dec 2024 08:59:00 +0100 Subject: [PATCH 27/32] Use XDEV's overlay of flyway-core --- tci-advanced-demo/persistence/pom.xml | 4 ++-- tci-advanced-demo/pom.xml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tci-advanced-demo/persistence/pom.xml b/tci-advanced-demo/persistence/pom.xml index 76b4c71..121c5bd 100644 --- a/tci-advanced-demo/persistence/pom.xml +++ b/tci-advanced-demo/persistence/pom.xml @@ -73,8 +73,8 @@ <!-- Database Migration --> <dependency> - <groupId>org.flywaydb</groupId> - <artifactId>flyway-core</artifactId> + <groupId>software.xdev</groupId> + <artifactId>flyway-core-slim</artifactId> </dependency> <dependency> <groupId>org.flywaydb</groupId> diff --git a/tci-advanced-demo/pom.xml b/tci-advanced-demo/pom.xml index 806b2fc..d8961a6 100644 --- a/tci-advanced-demo/pom.xml +++ b/tci-advanced-demo/pom.xml @@ -163,6 +163,11 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>software.xdev</groupId> + <artifactId>flyway-core-slim</artifactId> + <version>1.0.0</version> + </dependency> <!-- Utility for proxies in tests --> <dependency> From d2163d65640794ab3b49d8e3a702f4073fe4794d Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Tue, 17 Dec 2024 08:59:26 +0100 Subject: [PATCH 28/32] [Flyway] Stop spamming "newer database version" --- .../mysql/mariadb/MariaDBDatabase.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tci-advanced-demo/persistence/src/main/java/org/flywaydb/database/mysql/mariadb/MariaDBDatabase.java diff --git a/tci-advanced-demo/persistence/src/main/java/org/flywaydb/database/mysql/mariadb/MariaDBDatabase.java b/tci-advanced-demo/persistence/src/main/java/org/flywaydb/database/mysql/mariadb/MariaDBDatabase.java new file mode 100644 index 0000000..c8b1e14 --- /dev/null +++ b/tci-advanced-demo/persistence/src/main/java/org/flywaydb/database/mysql/mariadb/MariaDBDatabase.java @@ -0,0 +1,33 @@ +package org.flywaydb.database.mysql.mariadb; + +import org.flywaydb.core.api.configuration.Configuration; +import org.flywaydb.core.internal.jdbc.JdbcConnectionFactory; +import org.flywaydb.core.internal.jdbc.StatementInterceptor; +import org.flywaydb.database.mysql.MySQLDatabase; + + +/** + * Fork of default MariaDBDatabase + */ +public class MariaDBDatabase extends MySQLDatabase +{ + public MariaDBDatabase( + final Configuration configuration, + final JdbcConnectionFactory jdbcConnectionFactory, + final StatementInterceptor statementInterceptor) + { + super(configuration, jdbcConnectionFactory, statementInterceptor); + } + + @Override + protected String getConstraintName(final String tableName) + { + return ""; + } + + @Override + public void ensureSupported(final Configuration configuration) + { + // YES it is supported for what we do - stop spamming the log + } +} From 3b179d090ac1448c9eb00bcb846350e8ead09749 Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Tue, 17 Dec 2024 08:59:51 +0100 Subject: [PATCH 29/32] Fix hibernate annotation processor for now See also https://hibernate.atlassian.net/browse/HHH-18863 --- tci-advanced-demo/entities-metamodel/pom.xml | 26 +++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tci-advanced-demo/entities-metamodel/pom.xml b/tci-advanced-demo/entities-metamodel/pom.xml index 2d4a135..b8d83d9 100644 --- a/tci-advanced-demo/entities-metamodel/pom.xml +++ b/tci-advanced-demo/entities-metamodel/pom.xml @@ -73,7 +73,7 @@ <!-- https://hibernate.atlassian.net/browse/HHH-15877 --> <!-- @formatter:off DO NOT INTRODUCE LINE BREAK --> <compilerArguments> - -implicit:class -AfullyAnnotationConfigured=true -AaddGeneratedAnnotation=false + -implicit:class -AfullyAnnotationConfigured=true -AaddGeneratedAnnotation=false -Aindex=false </compilerArguments> <!-- @formatter:on --> <processors> @@ -83,6 +83,30 @@ </execution> </executions> </plugin> + + <!-- Can be removed once fix for https://hibernate.atlassian.net/browse/HHH-18863 is released --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <executions> + <!-- Workaround for https://hibernate.atlassian.net/browse/HHH-18873 --> + <execution> + <id>wipe-hibernate-entity-index</id> + <phase>generate-sources</phase> + <goals> + <goal>clean</goal> + </goals> + <configuration> + <excludeDefaultDirectories>true</excludeDefaultDirectories> + <filesets> + <fileset> + <directory>${project.generated.sources}/entity</directory> + </fileset> + </filesets> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </project> From a5b38ef1b260783ae3957ddf59d1c810e3ebaa5b Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Tue, 17 Dec 2024 09:00:08 +0100 Subject: [PATCH 30/32] Sync/Showcase CDS --- tci-advanced-demo/tci-webapp/Dockerfile | 85 +++++++++++++------ .../containers/WebAppContainerBuilder.java | 2 + tci-advanced-demo/webapp/Dockerfile | 66 ++++++++++++-- 3 files changed, 118 insertions(+), 35 deletions(-) diff --git a/tci-advanced-demo/tci-webapp/Dockerfile b/tci-advanced-demo/tci-webapp/Dockerfile index 4907838..c78a8f5 100644 --- a/tci-advanced-demo/tci-webapp/Dockerfile +++ b/tci-advanced-demo/tci-webapp/Dockerfile @@ -1,27 +1,14 @@ -# Note: This Dockerfile is used by the selenium tests for compiling the WebApp when there was no Image supplied +# Note: This Dockerfile is used by the selenium tests for compiling Timeline when there was no Image supplied +# See also https://docs.spring.io/spring-boot/reference/packaging/container-images/dockerfiles.html for further information -FROM maven:3-eclipse-temurin-21-alpine AS build-env +FROM maven:3-eclipse-temurin-21-alpine AS builder RUN apk add --no-cache git -# Create non root user -ARG userName=limitedbuild -ARG groupName=limitedbuild -ARG userId=1000 +WORKDIR /builder -RUN addgroup --system ${groupName} \ - && adduser --uid ${userId} --system --disabled-password --shell /bin/bash ${userName} \ - && adduser ${userName} ${groupName} - -# Create build dir -RUN mkdir /build \ - && chown ${userName}:${groupName} /build -WORKDIR /build - -USER ${userName} - -# Copying is prepared by TCI -COPY --chown=${userName}:${groupName} . ./ +# Copying is prepared by ITC +COPY . ./ # A valid Git repo is required for the build RUN git config --global user.email "dynamic@build.local" \ @@ -34,9 +21,14 @@ ARG mavenbuildcmd='mvn -B clean package -pl "webapp" -am -Pprod,dev-log -T2C -Dm RUN echo "Executing '$mavenbuildcmd'" RUN ${mavenbuildcmd} +RUN mv webapp/target/webapp.jar app.jar \ + && java -Djarmode=tools -jar app.jar extract --layers --destination extracted + FROM eclipse-temurin:21-jre-alpine +ARG ENABLE_CDS= + ARG user=app ARG group=app ARG uid=1000 @@ -47,17 +39,54 @@ ARG APP_DIR=/opt/app RUN mkdir -p ${APP_DIR} \ && chown ${uid}:${gid} ${APP_DIR} \ && addgroup -g ${gid} ${group} \ - && adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/sh -D ${user} + && adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/bash -D ${user} -# MaxRAMPercentage: Default value is 25% -> we want to use available memory optimal -> increased, but enough is left for other RAM usages like e.g. Metaspace -# Min/MaxHeapFreeRatio: Default values cause container reserved memory not to shrink properly/waste memory -> decreased -# https://stackoverflow.com/questions/16058250/what-is-the-purpose-of-xxminheapfreeratio-and-xxmaxheapfreeratio -ENV JAVA_OPTS "-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true" - -EXPOSE 8080 +WORKDIR ${APP_DIR} USER ${user} -COPY --from=build-env --chown=${user}:${group} build/webapp/target/webapp.jar ${APP_DIR}/webapp.jar +COPY --from=builder --chown=${user}:${group} /builder/extracted/dependencies/ ./ +COPY --from=builder --chown=${user}:${group} /builder/extracted/spring-boot-loader/ ./ +COPY --from=builder --chown=${user}:${group} /builder/extracted/snapshot-dependencies/ ./ +COPY --from=builder --chown=${user}:${group} /builder/extracted/application/ ./ + +# RUN CDS and boot with dummy configuration +RUN if [[ ! -z "$ENABLE_CDS" ]]; then \ + java -XX:ArchiveClassesAtExit=app.jsa \ + -Dspring.context.exit=onRefresh \ + # Disable Flyway + -Dspring.flyway.enabled=false \ + # Disabled DB actuator endpoint + -Dmanagement.health.db.enabled=false \ + # Disbale DB instant connection + -Dspring.jpa.database-platform=software.xdev.tci.demo.persistence.config.dialect.DefaultDialect \ + -Dspring.jpa.properties.hibernate.boot.allow.jdbc.metadata.access=false \ + # Fake DB + -Dspring.datasource.url=jdbc:mariadb://localhost:3306/dummy \ + -Dspring.datasource.username=dummy \ + -Dspring.datasource.password=dummy \ + # Fake Auth + -Dspring.security.oauth2.client.registration.local.authorization-grant-type=authorization_code \ + -Dspring.security.oauth2.client.registration.local.redirect-uri="{baseUrl}/{action}/oauth2/code/{registrationId}" \ + -Dspring.security.oauth2.client.provider.local.authorization-uri=http://localhost/connect/authorize \ + -Dspring.security.oauth2.client.provider.local.token-uri=http://localhost/connect/token \ + -Dspring.security.oauth2.client.provider.local.jwk-set-uri=http://localhost/.well-known/openid-configuration/jwks \ + -Dspring.security.oauth2.client.provider.local.user-info-uri=http://localhost/connect/userinfo \ + -Dspring.security.oauth2.client.provider.local.user-info-authentication-method=header \ + -Dspring.security.oauth2.client.provider.local.user-name-attribute=sub \ + -Dspring.security.oauth2.client.registration.local.client-name=Local \ + -Dspring.security.oauth2.client.registration.local.client-id=dummy \ + -Dspring.security.oauth2.client.registration.local.client-secret=dummy \ + -Dspring.security.oauth2.client.registration.local.scope="openid,profile,email,offline_access" \ + # Actuator + -Ddemo.actuator.username=dummy \ + -Ddemo.actuator.password-hash=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 \ + -jar app.jar; \ + fi + +ENV JAVA_OPTS="-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true" +ENV JAVA_CDS_OPTS=${ENABLE_CDS:+"-XX:SharedArchiveFile=app.jsa"} + +EXPOSE 8080 -CMD java ${JAVA_OPTS} -jar /opt/app/webapp.jar +CMD [ "/bin/sh", "-c", "java $JAVA_OPTS $JAVA_CDS_OPTS -jar /opt/app/app.jar" ] diff --git a/tci-advanced-demo/tci-webapp/src/main/java/software/xdev/tci/demo/tci/webapp/containers/WebAppContainerBuilder.java b/tci-advanced-demo/tci-webapp/src/main/java/software/xdev/tci/demo/tci/webapp/containers/WebAppContainerBuilder.java index 2e74555..1a4692a 100644 --- a/tci-advanced-demo/tci-webapp/src/main/java/software/xdev/tci/demo/tci/webapp/containers/WebAppContainerBuilder.java +++ b/tci-advanced-demo/tci-webapp/src/main/java/software/xdev/tci/demo/tci/webapp/containers/WebAppContainerBuilder.java @@ -33,6 +33,8 @@ public static synchronized String getBuiltImageName() final AdvancedImageFromDockerFile builder = new AdvancedImageFromDockerFile("webapp-it-local", false) + // Use Class Data Sharing to boot app a bit faster (however requires a bit more time during build) + .withBuildArg("ENABLE_CDS", "1") .withLoggerForBuild(LOG_CONTAINER_BUILD) .withAdditionalIgnoreLines( // Ignore git-folder, as it will be provided in the Dockerfile diff --git a/tci-advanced-demo/webapp/Dockerfile b/tci-advanced-demo/webapp/Dockerfile index d3b844f..386777d 100644 --- a/tci-advanced-demo/webapp/Dockerfile +++ b/tci-advanced-demo/webapp/Dockerfile @@ -1,5 +1,17 @@ +# See also https://docs.spring.io/spring-boot/reference/packaging/container-images/dockerfiles.html for further information +FROM eclipse-temurin:21-jre-alpine AS builder + +WORKDIR /builder + +COPY target/webapp.jar app.jar + +RUN java -Djarmode=tools -jar app.jar extract --layers --destination extracted + + FROM eclipse-temurin:21-jre-alpine +ARG ENABLE_CDS= + ARG user=app ARG group=app ARG uid=1000 @@ -10,17 +22,57 @@ ARG APP_DIR=/opt/app RUN mkdir -p ${APP_DIR} \ && chown ${uid}:${gid} ${APP_DIR} \ && addgroup -g ${gid} ${group} \ - && adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/sh -D ${user} + && adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/bash -D ${user} + +WORKDIR ${APP_DIR} + +USER ${user} + +COPY --from=builder --chown=${user}:${group} /builder/extracted/dependencies/ ./ +COPY --from=builder --chown=${user}:${group} /builder/extracted/spring-boot-loader/ ./ +COPY --from=builder --chown=${user}:${group} /builder/extracted/snapshot-dependencies/ ./ +COPY --from=builder --chown=${user}:${group} /builder/extracted/application/ ./ + +# Do CDS and boot with dummy configuration +RUN if [[ ! -z "$ENABLE_CDS" ]]; then \ + java -XX:ArchiveClassesAtExit=app.jsa \ + -Dspring.context.exit=onRefresh \ + # Disable Flyway + -Dspring.flyway.enabled=false \ + # Disabled DB actuator endpoint + -Dmanagement.health.db.enabled=false \ + # Disbale DB instant connection + -Dspring.jpa.database-platform=software.xdev.tci.demo.persistence.config.dialect.DefaultDialect \ + -Dspring.jpa.properties.hibernate.boot.allow.jdbc.metadata.access=false \ + # Fake DB + -Dspring.datasource.url=jdbc:mariadb://localhost:3306/dummy \ + -Dspring.datasource.username=dummy \ + -Dspring.datasource.password=dummy \ + # Fake Auth + -Dspring.security.oauth2.client.registration.local.authorization-grant-type=authorization_code \ + -Dspring.security.oauth2.client.registration.local.redirect-uri="{baseUrl}/{action}/oauth2/code/{registrationId}" \ + -Dspring.security.oauth2.client.provider.local.authorization-uri=http://localhost/connect/authorize \ + -Dspring.security.oauth2.client.provider.local.token-uri=http://localhost/connect/token \ + -Dspring.security.oauth2.client.provider.local.jwk-set-uri=http://localhost/.well-known/openid-configuration/jwks \ + -Dspring.security.oauth2.client.provider.local.user-info-uri=http://localhost/connect/userinfo \ + -Dspring.security.oauth2.client.provider.local.user-info-authentication-method=header \ + -Dspring.security.oauth2.client.provider.local.user-name-attribute=sub \ + -Dspring.security.oauth2.client.registration.local.client-name=Local \ + -Dspring.security.oauth2.client.registration.local.client-id=dummy \ + -Dspring.security.oauth2.client.registration.local.client-secret=dummy \ + -Dspring.security.oauth2.client.registration.local.scope="openid,profile,email,offline_access" \ + # Actuator + -Ddemo.actuator.username=dummy \ + -Ddemo.actuator.password-hash=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 \ + -jar app.jar; \ + fi # MaxRAMPercentage: Default value is 25% -> we want to use available memory optimal -> increased, but enough is left for other RAM usages like e.g. Metaspace # Min/MaxHeapFreeRatio: Default values cause container reserved memory not to shrink properly/waste memory -> decreased # https://stackoverflow.com/questions/16058250/what-is-the-purpose-of-xxminheapfreeratio-and-xxmaxheapfreeratio -ENV JAVA_OPTS "-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true" +ENV JAVA_OPTS="-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true" +ENV JAVA_CDS_OPTS=${ENABLE_CDS:+"-XX:SharedArchiveFile=app.jsa"} EXPOSE 8080 -USER ${user} - -COPY --chown=${user}:${group} target/webapp.jar ${APP_DIR}/webapp.jar - -CMD java ${JAVA_OPTS} -jar /opt/app/webapp.jar +CMD [ "/bin/sh", "-c", "java $JAVA_OPTS $JAVA_CDS_OPTS -jar app.jar" ] From 93441de354f67f1f3b61b311aa5dee131ce6c0a7 Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Tue, 17 Dec 2024 09:01:16 +0100 Subject: [PATCH 31/32] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 868874d..86ecc7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.0.4 +* Updated dependencies + # 1.0.3 * Fix ``ConcurrentModificationException`` due to missing synchronized blocks * Don't warmUp already warmed up factories again on coordinator level From d246487bf064136474bd3cefa4a26a00cd1e64d3 Mon Sep 17 00:00:00 2001 From: AB <a.bierler@xdev-software.de> Date: Tue, 17 Dec 2024 09:05:13 +0100 Subject: [PATCH 32/32] Revert "Sync/Showcase CDS" This reverts commit a5b38ef1b260783ae3957ddf59d1c810e3ebaa5b. --- tci-advanced-demo/tci-webapp/Dockerfile | 85 ++++++------------- .../containers/WebAppContainerBuilder.java | 2 - tci-advanced-demo/webapp/Dockerfile | 66 ++------------ 3 files changed, 35 insertions(+), 118 deletions(-) diff --git a/tci-advanced-demo/tci-webapp/Dockerfile b/tci-advanced-demo/tci-webapp/Dockerfile index c78a8f5..4907838 100644 --- a/tci-advanced-demo/tci-webapp/Dockerfile +++ b/tci-advanced-demo/tci-webapp/Dockerfile @@ -1,14 +1,27 @@ -# Note: This Dockerfile is used by the selenium tests for compiling Timeline when there was no Image supplied -# See also https://docs.spring.io/spring-boot/reference/packaging/container-images/dockerfiles.html for further information +# Note: This Dockerfile is used by the selenium tests for compiling the WebApp when there was no Image supplied -FROM maven:3-eclipse-temurin-21-alpine AS builder +FROM maven:3-eclipse-temurin-21-alpine AS build-env RUN apk add --no-cache git -WORKDIR /builder +# Create non root user +ARG userName=limitedbuild +ARG groupName=limitedbuild +ARG userId=1000 -# Copying is prepared by ITC -COPY . ./ +RUN addgroup --system ${groupName} \ + && adduser --uid ${userId} --system --disabled-password --shell /bin/bash ${userName} \ + && adduser ${userName} ${groupName} + +# Create build dir +RUN mkdir /build \ + && chown ${userName}:${groupName} /build +WORKDIR /build + +USER ${userName} + +# Copying is prepared by TCI +COPY --chown=${userName}:${groupName} . ./ # A valid Git repo is required for the build RUN git config --global user.email "dynamic@build.local" \ @@ -21,14 +34,9 @@ ARG mavenbuildcmd='mvn -B clean package -pl "webapp" -am -Pprod,dev-log -T2C -Dm RUN echo "Executing '$mavenbuildcmd'" RUN ${mavenbuildcmd} -RUN mv webapp/target/webapp.jar app.jar \ - && java -Djarmode=tools -jar app.jar extract --layers --destination extracted - FROM eclipse-temurin:21-jre-alpine -ARG ENABLE_CDS= - ARG user=app ARG group=app ARG uid=1000 @@ -39,54 +47,17 @@ ARG APP_DIR=/opt/app RUN mkdir -p ${APP_DIR} \ && chown ${uid}:${gid} ${APP_DIR} \ && addgroup -g ${gid} ${group} \ - && adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/bash -D ${user} + && adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/sh -D ${user} -WORKDIR ${APP_DIR} +# MaxRAMPercentage: Default value is 25% -> we want to use available memory optimal -> increased, but enough is left for other RAM usages like e.g. Metaspace +# Min/MaxHeapFreeRatio: Default values cause container reserved memory not to shrink properly/waste memory -> decreased +# https://stackoverflow.com/questions/16058250/what-is-the-purpose-of-xxminheapfreeratio-and-xxmaxheapfreeratio +ENV JAVA_OPTS "-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true" -USER ${user} +EXPOSE 8080 -COPY --from=builder --chown=${user}:${group} /builder/extracted/dependencies/ ./ -COPY --from=builder --chown=${user}:${group} /builder/extracted/spring-boot-loader/ ./ -COPY --from=builder --chown=${user}:${group} /builder/extracted/snapshot-dependencies/ ./ -COPY --from=builder --chown=${user}:${group} /builder/extracted/application/ ./ - -# RUN CDS and boot with dummy configuration -RUN if [[ ! -z "$ENABLE_CDS" ]]; then \ - java -XX:ArchiveClassesAtExit=app.jsa \ - -Dspring.context.exit=onRefresh \ - # Disable Flyway - -Dspring.flyway.enabled=false \ - # Disabled DB actuator endpoint - -Dmanagement.health.db.enabled=false \ - # Disbale DB instant connection - -Dspring.jpa.database-platform=software.xdev.tci.demo.persistence.config.dialect.DefaultDialect \ - -Dspring.jpa.properties.hibernate.boot.allow.jdbc.metadata.access=false \ - # Fake DB - -Dspring.datasource.url=jdbc:mariadb://localhost:3306/dummy \ - -Dspring.datasource.username=dummy \ - -Dspring.datasource.password=dummy \ - # Fake Auth - -Dspring.security.oauth2.client.registration.local.authorization-grant-type=authorization_code \ - -Dspring.security.oauth2.client.registration.local.redirect-uri="{baseUrl}/{action}/oauth2/code/{registrationId}" \ - -Dspring.security.oauth2.client.provider.local.authorization-uri=http://localhost/connect/authorize \ - -Dspring.security.oauth2.client.provider.local.token-uri=http://localhost/connect/token \ - -Dspring.security.oauth2.client.provider.local.jwk-set-uri=http://localhost/.well-known/openid-configuration/jwks \ - -Dspring.security.oauth2.client.provider.local.user-info-uri=http://localhost/connect/userinfo \ - -Dspring.security.oauth2.client.provider.local.user-info-authentication-method=header \ - -Dspring.security.oauth2.client.provider.local.user-name-attribute=sub \ - -Dspring.security.oauth2.client.registration.local.client-name=Local \ - -Dspring.security.oauth2.client.registration.local.client-id=dummy \ - -Dspring.security.oauth2.client.registration.local.client-secret=dummy \ - -Dspring.security.oauth2.client.registration.local.scope="openid,profile,email,offline_access" \ - # Actuator - -Ddemo.actuator.username=dummy \ - -Ddemo.actuator.password-hash=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 \ - -jar app.jar; \ - fi - -ENV JAVA_OPTS="-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true" -ENV JAVA_CDS_OPTS=${ENABLE_CDS:+"-XX:SharedArchiveFile=app.jsa"} +USER ${user} -EXPOSE 8080 +COPY --from=build-env --chown=${user}:${group} build/webapp/target/webapp.jar ${APP_DIR}/webapp.jar -CMD [ "/bin/sh", "-c", "java $JAVA_OPTS $JAVA_CDS_OPTS -jar /opt/app/app.jar" ] +CMD java ${JAVA_OPTS} -jar /opt/app/webapp.jar diff --git a/tci-advanced-demo/tci-webapp/src/main/java/software/xdev/tci/demo/tci/webapp/containers/WebAppContainerBuilder.java b/tci-advanced-demo/tci-webapp/src/main/java/software/xdev/tci/demo/tci/webapp/containers/WebAppContainerBuilder.java index 1a4692a..2e74555 100644 --- a/tci-advanced-demo/tci-webapp/src/main/java/software/xdev/tci/demo/tci/webapp/containers/WebAppContainerBuilder.java +++ b/tci-advanced-demo/tci-webapp/src/main/java/software/xdev/tci/demo/tci/webapp/containers/WebAppContainerBuilder.java @@ -33,8 +33,6 @@ public static synchronized String getBuiltImageName() final AdvancedImageFromDockerFile builder = new AdvancedImageFromDockerFile("webapp-it-local", false) - // Use Class Data Sharing to boot app a bit faster (however requires a bit more time during build) - .withBuildArg("ENABLE_CDS", "1") .withLoggerForBuild(LOG_CONTAINER_BUILD) .withAdditionalIgnoreLines( // Ignore git-folder, as it will be provided in the Dockerfile diff --git a/tci-advanced-demo/webapp/Dockerfile b/tci-advanced-demo/webapp/Dockerfile index 386777d..d3b844f 100644 --- a/tci-advanced-demo/webapp/Dockerfile +++ b/tci-advanced-demo/webapp/Dockerfile @@ -1,17 +1,5 @@ -# See also https://docs.spring.io/spring-boot/reference/packaging/container-images/dockerfiles.html for further information -FROM eclipse-temurin:21-jre-alpine AS builder - -WORKDIR /builder - -COPY target/webapp.jar app.jar - -RUN java -Djarmode=tools -jar app.jar extract --layers --destination extracted - - FROM eclipse-temurin:21-jre-alpine -ARG ENABLE_CDS= - ARG user=app ARG group=app ARG uid=1000 @@ -22,57 +10,17 @@ ARG APP_DIR=/opt/app RUN mkdir -p ${APP_DIR} \ && chown ${uid}:${gid} ${APP_DIR} \ && addgroup -g ${gid} ${group} \ - && adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/bash -D ${user} - -WORKDIR ${APP_DIR} - -USER ${user} - -COPY --from=builder --chown=${user}:${group} /builder/extracted/dependencies/ ./ -COPY --from=builder --chown=${user}:${group} /builder/extracted/spring-boot-loader/ ./ -COPY --from=builder --chown=${user}:${group} /builder/extracted/snapshot-dependencies/ ./ -COPY --from=builder --chown=${user}:${group} /builder/extracted/application/ ./ - -# Do CDS and boot with dummy configuration -RUN if [[ ! -z "$ENABLE_CDS" ]]; then \ - java -XX:ArchiveClassesAtExit=app.jsa \ - -Dspring.context.exit=onRefresh \ - # Disable Flyway - -Dspring.flyway.enabled=false \ - # Disabled DB actuator endpoint - -Dmanagement.health.db.enabled=false \ - # Disbale DB instant connection - -Dspring.jpa.database-platform=software.xdev.tci.demo.persistence.config.dialect.DefaultDialect \ - -Dspring.jpa.properties.hibernate.boot.allow.jdbc.metadata.access=false \ - # Fake DB - -Dspring.datasource.url=jdbc:mariadb://localhost:3306/dummy \ - -Dspring.datasource.username=dummy \ - -Dspring.datasource.password=dummy \ - # Fake Auth - -Dspring.security.oauth2.client.registration.local.authorization-grant-type=authorization_code \ - -Dspring.security.oauth2.client.registration.local.redirect-uri="{baseUrl}/{action}/oauth2/code/{registrationId}" \ - -Dspring.security.oauth2.client.provider.local.authorization-uri=http://localhost/connect/authorize \ - -Dspring.security.oauth2.client.provider.local.token-uri=http://localhost/connect/token \ - -Dspring.security.oauth2.client.provider.local.jwk-set-uri=http://localhost/.well-known/openid-configuration/jwks \ - -Dspring.security.oauth2.client.provider.local.user-info-uri=http://localhost/connect/userinfo \ - -Dspring.security.oauth2.client.provider.local.user-info-authentication-method=header \ - -Dspring.security.oauth2.client.provider.local.user-name-attribute=sub \ - -Dspring.security.oauth2.client.registration.local.client-name=Local \ - -Dspring.security.oauth2.client.registration.local.client-id=dummy \ - -Dspring.security.oauth2.client.registration.local.client-secret=dummy \ - -Dspring.security.oauth2.client.registration.local.scope="openid,profile,email,offline_access" \ - # Actuator - -Ddemo.actuator.username=dummy \ - -Ddemo.actuator.password-hash=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 \ - -jar app.jar; \ - fi + && adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/sh -D ${user} # MaxRAMPercentage: Default value is 25% -> we want to use available memory optimal -> increased, but enough is left for other RAM usages like e.g. Metaspace # Min/MaxHeapFreeRatio: Default values cause container reserved memory not to shrink properly/waste memory -> decreased # https://stackoverflow.com/questions/16058250/what-is-the-purpose-of-xxminheapfreeratio-and-xxmaxheapfreeratio -ENV JAVA_OPTS="-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true" -ENV JAVA_CDS_OPTS=${ENABLE_CDS:+"-XX:SharedArchiveFile=app.jsa"} +ENV JAVA_OPTS "-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true" EXPOSE 8080 -CMD [ "/bin/sh", "-c", "java $JAVA_OPTS $JAVA_CDS_OPTS -jar app.jar" ] +USER ${user} + +COPY --chown=${user}:${group} target/webapp.jar ${APP_DIR}/webapp.jar + +CMD java ${JAVA_OPTS} -jar /opt/app/webapp.jar