From 0e9b3c73ea9237ea5648459dfc9b5f15b29586a6 Mon Sep 17 00:00:00 2001 From: Andrei Piankouski Date: Tue, 29 Oct 2024 14:43:29 +0300 Subject: [PATCH] EPMRPP-96325 || Update to Spring Boot 3 --- Dockerfile | 4 +- build.gradle | 46 ++++++++----------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../calculation/RetryCalculation.java | 23 ---------- .../config/rabbit/RabbitMqConfiguration.java | 10 ---- 5 files changed, 21 insertions(+), 64 deletions(-) delete mode 100644 src/main/java/com/epam/reportportal/calculation/RetryCalculation.java diff --git a/Dockerfile b/Dockerfile index ba3c618..dab977c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM gradle:8.10.0-jdk21 AS build +FROM --platform=$BUILDPLATFORM gradle:8.10.2-jdk21 AS build ARG RELEASE_MODE ARG APP_VERSION WORKDIR /usr/app @@ -9,7 +9,7 @@ RUN if [ "${RELEASE_MODE}" = true ]; then \ -Dorg.gradle.project.version=${APP_VERSION}; \ else gradle build --exclude-task test -Dorg.gradle.project.version=${APP_VERSION}; fi -FROM amazoncorretto:21.0.4 +FROM amazoncorretto:21.0.5 LABEL version=${APP_VERSION} description="EPAM Report portal. Jobs Service" maintainer="Andrei Varabyeu , Hleb Kanonik " ARG APP_VERSION=${APP_VERSION} ENV APP_DIR=/usr/app diff --git a/build.gradle b/build.gradle index 365b30b..6368c92 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.springframework.boot' version '2.7.18' + id 'org.springframework.boot' version '3.3.5' id 'io.spring.dependency-management' version '1.1.4' id 'java' } @@ -15,7 +15,6 @@ def scriptsUrl = 'https://raw.githubusercontent.com/reportportal/gradle-scripts/ apply from: "$scriptsUrl/build-commons.gradle" apply from: "$scriptsUrl/build-info.gradle" -//apply from: "$scriptsUrl/build-quality.gradle" apply from: "$scriptsUrl/release-service.gradle" apply from: "$scriptsUrl/signing.gradle" @@ -25,7 +24,7 @@ tasks.withType(JavaCompile).configureEach { } wrapper { - gradleVersion = '8.10' + gradleVersion = '8.10.2' } bootJar { @@ -47,63 +46,54 @@ processResources { } } -//https://nvd.nist.gov/vuln/detail/CVE-2020-9488 and https://nvd.nist.gov/vuln/detail/CVE-2021-44228 and https://nvd.nist.gov/vuln/detail/CVE-2021-45046 and -//https://nvd.nist.gov/vuln/detail/CVE-2021-45105 ext['log4j2.version'] = '2.21.1' ext['log4j-to-slf4j.version'] = '2.21.1' -//https://nvd.nist.gov/vuln/detail/CVE-2022-26520 ext['postgresql.version'] = '42.6.1' ext['snakeyaml.version'] = '2.2' -ext['spring-boot.version'] = '2.7.18' +ext['spring-boot.version'] = '3.3.5' // dependencies { implementation 'org.json:json:20231013' - implementation 'net.javacrumbs.shedlock:shedlock-spring:4.46.0' + implementation 'net.javacrumbs.shedlock:shedlock-spring:5.16.0' implementation 'net.javacrumbs.shedlock:shedlock-provider-jdbc-template:4.46.0' // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 implementation 'org.apache.commons:commons-lang3:3.12.0' - // Fix CVE-2023-46589, CVE-2024-24549 - implementation 'org.apache.tomcat.embed:tomcat-embed-core:9.0.86' - implementation 'org.apache.tomcat.embed:tomcat-embed-el:9.0.86' - implementation 'org.apache.tomcat.embed:tomcat-embed-websocket:9.0.86' + implementation 'org.apache.tomcat.embed:tomcat-embed-core:9.0.96' + implementation 'org.apache.tomcat.embed:tomcat-embed-el:9.0.96' + implementation 'org.apache.tomcat.embed:tomcat-embed-websocket:9.0.96' - //Fix CVE-2023-6378, CVE-2023-6481, CVE-2023-6378, CVE-2023-6481 - implementation 'ch.qos.logback:logback-classic:1.2.13' - implementation 'ch.qos.logback:logback-core:1.2.13' - - //Fix CVE-2023-40827, CVE-2023-40828, CVE-2023-40826 - implementation 'org.springframework:spring-webmvc:5.3.33' - implementation 'org.springframework:spring-web:5.3.33' - - // Fix CVE-2024-25710, CVE-2024-26308 + implementation 'ch.qos.logback:logback-classic' + implementation 'ch.qos.logback:logback-core' + implementation 'org.springframework:spring-webmvc' + implementation 'org.springframework:spring-web' implementation 'org.apache.commons:commons-compress:1.26.0' + implementation 'javax.xml.bind:jaxb-api:2.3.1' - //Fix CVE-2023-34050 - implementation 'org.springframework.amqp:spring-amqp:2.4.17' + implementation 'org.springframework.amqp:spring-amqp' implementation 'org.springframework.boot:spring-boot-starter-aop' implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-jdbc' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-amqp' - implementation 'org.springframework:spring-jdbc:6.1.5' + implementation 'org.springframework:spring-jdbc' implementation 'org.apache.jclouds.api:s3:2.5.0' implementation 'org.apache.jclouds.provider:aws-s3:2.5.0' implementation 'org.apache.jclouds.api:filesystem:2.5.0' //Needed for correct jcloud work implementation 'com.google.code.gson:gson:2.8.9' - implementation 'org.apache.httpcomponents:httpclient:4.5.14' -// https://avd.aquasec.com/nvd/cve-2020-8908 + implementation ('org.apache.httpcomponents:httpclient:4.5.14') { + exclude group: 'commons-logging', module: 'commons-logging' + } implementation 'com.google.guava:guava:32.1.3-jre' implementation "com.rabbitmq:http-client:5.2.0" - //Fix CVE - implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.3' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.4' runtimeOnly 'org.postgresql:postgresql' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9355b41..df97d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/com/epam/reportportal/calculation/RetryCalculation.java b/src/main/java/com/epam/reportportal/calculation/RetryCalculation.java deleted file mode 100644 index 64c5289..0000000 --- a/src/main/java/com/epam/reportportal/calculation/RetryCalculation.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.epam.reportportal.calculation; - - -import org.springframework.scheduling.concurrent.DefaultManagedTaskScheduler; -import org.springframework.stereotype.Component; - -@Component -// example of usage -public class RetryCalculation { - - private final RetryProcessing retryProcessing; - - public RetryCalculation() { - retryProcessing = new RetryProcessing(5, 3000, new DefaultManagedTaskScheduler()); - } - - /* example of using fill be removed during integration - @RabbitListener(queues = "some_queue") - public void calculate(Object retryItem) { - retryProcessing.add(retryItem); - } - */ -} diff --git a/src/main/java/com/epam/reportportal/config/rabbit/RabbitMqConfiguration.java b/src/main/java/com/epam/reportportal/config/rabbit/RabbitMqConfiguration.java index 7c4c1f4..22fb270 100644 --- a/src/main/java/com/epam/reportportal/config/rabbit/RabbitMqConfiguration.java +++ b/src/main/java/com/epam/reportportal/config/rabbit/RabbitMqConfiguration.java @@ -29,7 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -74,15 +73,6 @@ public RabbitAdmin rabbitAdmin( return new RabbitAdmin(connectionFactory); } - @Bean - SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory( - SimpleRabbitListenerContainerFactoryConfigurer configurer, - @Qualifier("connectionFactory") ConnectionFactory connectionFactory) { - SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); - configurer.configure(factory, connectionFactory); - return factory; - } - @Bean(name = "rabbitTemplate") public RabbitTemplate rabbitTemplate( @Autowired @Qualifier("connectionFactory") ConnectionFactory connectionFactory,