Skip to content

Commit

Permalink
Merge pull request #2117 from reportportal/rc/5.13.0
Browse files Browse the repository at this point in the history
5.13.0 Release
  • Loading branch information
pbortnik authored Dec 11, 2024
2 parents 2f363c6 + ab76b4f commit 704c835
Show file tree
Hide file tree
Showing 69 changed files with 1,818 additions and 1,209 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-dev-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ jobs:
image-tag: 'develop-${{ github.run_number }}'
version: 'develop-${{ github.run_number }}'
date: ${{ needs.variables-setup.outputs.date }}
runs-on: ubuntu-latest
secrets: inherit
2 changes: 2 additions & 0 deletions .github/workflows/build-feature-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
types: [opened, synchronize, reopened]
branches:
- 'develop'
workflow_dispatch:

jobs:
variables-setup:
Expand Down Expand Up @@ -34,4 +35,5 @@ jobs:
version: ${{ needs.variables-setup.outputs.tag }}
branch: ${{ github.head_ref }}
date: ${{ needs.variables-setup.outputs.date }}
runs-on: ubuntu-latest
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/build-rc-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ jobs:
build-platforms: ${{ needs.variables-setup.outputs.platforms }}
version: ${{ needs.variables-setup.outputs.version }}
date: ${{ needs.variables-setup.outputs.date }}
runs-on: ubuntu-latest
secrets: inherit
5 changes: 3 additions & 2 deletions .github/workflows/java-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- gradle.properties

jobs:
call-java-cheks:
name: Call Java checks
call-java-checks:
name: Call Java Checks
uses: reportportal/.github/.github/workflows/java-checks.yaml@main
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
GH_USER_NAME: github.actor
RELEASE_VERSION: 5.12.1
RELEASE_VERSION: 5.13.0
REPOSITORY_URL: 'https://maven.pkg.github.com/'

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN if [ "${RELEASE_MODE}" = true ]; then \
-Dorg.gradle.project.version=${APP_VERSION}; \
else gradle build --no-build-cache --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. Main API Service" maintainer="Andrei Varabyeu <andrei_varabyeu@epam.com>, Hleb Kanonik <hleb_kanonik@epam.com>"
ARG APP_VERSION=${APP_VERSION}
ENV APP_DIR=/usr/app
Expand Down
47 changes: 36 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ plugins {
id 'org.springframework.boot' version '2.5.15'
id 'java'
id "org.owasp.dependencycheck" version "9.0.9"
id "com.epam.drill.integration.cicd" version "0.1.6"
}

import org.owasp.dependencycheck.reporting.ReportGenerator
Expand All @@ -29,9 +30,12 @@ apply from: "$scriptsUrl/build-info.gradle"
apply from: "$scriptsUrl/release-service.gradle"
apply from: "$scriptsUrl/signing.gradle"
apply from: "$scriptsUrl/copy-database-scripts.gradle"

//replaced with drill4j
//apply from: "$scriptsUrl/build-quality.gradle"
apply from: "$scriptsUrl/jacoco.gradle"
apply plugin: 'jacoco'
//apply from: "$scriptsUrl/jacoco.gradle"
//apply plugin: 'jacoco'

project.hasProperty('sealightsSession') && sealightsSession?.trim() ? apply(from: 'sealights.gradle') : println('No sealights session')

repositories {
Expand All @@ -57,7 +61,7 @@ ext['spring-boot.version'] = '2.5.15'

dependencyManagement {
imports {
mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + '5.12.3' : 'com.epam.reportportal:commons-bom:5.12.3')
mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + '5.13.0' : 'com.epam.reportportal:commons-bom:5.13.0')
mavenBom('io.zonky.test.postgres:embedded-postgres-binaries-bom:16.2.0')
}
}
Expand All @@ -68,9 +72,9 @@ dependencies {
implementation 'com.epam.reportportal:commons'
implementation 'com.epam.reportportal:plugin-api'
} else {
implementation 'com.github.reportportal:commons-dao:acf1ec7'
implementation 'com.github.reportportal:commons:7762418'
implementation 'com.github.reportportal:plugin-api:188792e'
implementation 'com.github.reportportal:commons-dao:a98c172'
implementation 'com.github.reportportal:commons:26ab837'
implementation 'com.github.reportportal:plugin-api:8a1f61c'
}

implementation 'org.springframework.boot:spring-boot-starter-aop'
Expand Down Expand Up @@ -106,11 +110,12 @@ dependencies {
implementation "com.rabbitmq:http-client:5.2.0"

implementation 'com.sun.mail:javax.mail:1.6.2'
// check authentication error response format for versions higher than 6.21.3
implementation('net.sf.jasperreports:jasperreports:6.21.3') {
exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-xml'
}
implementation 'xerces:xercesImpl:2.12.2'
implementation 'com.lowagie:itext:2.1.7.js7'
implementation 'com.lowagie:itext:4.2.2'
// Fix CVE-2020-15522 in com.lowagie:itext:2.1.7.js7
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
// JasperReport's export to XLS uses Apache POI
Expand All @@ -121,9 +126,9 @@ dependencies {

///// Security
//https://nvd.nist.gov/vuln/detail/CVE-2020-5407 AND https://nvd.nist.gov/vuln/detail/CVE-2020-5408
implementation 'org.springframework.security:spring-security-core:5.8.14'
implementation 'org.springframework.security:spring-security-config:5.8.14'
implementation 'org.springframework.security:spring-security-web:5.8.14'
implementation 'org.springframework.security:spring-security-core:5.8.16'
implementation 'org.springframework.security:spring-security-config:5.8.16'
implementation 'org.springframework.security:spring-security-web:5.8.16'
//

// Fix CVE-2022-22969
Expand Down Expand Up @@ -209,4 +214,24 @@ test {
publish.dependsOn build
publish.mustRunAfter build
checkCommitNeeded.dependsOn removeScripts
build.dependsOn jacocoTestReport

//replaced with drill4j
//build.dependsOn jacocoTestReport

drill {
groupId = "report-portal"
appId = "service-api"
packagePrefixes = ["com/epam/ta/reportportal"]
enableTestAgent {
enabled = System.getenv("DRILL_AGENT_ENABLED") == "true" ?: false
version = "0.23.3"
}
enableAppAgent {
enabled = System.getenv("DRILL_AGENT_ENABLED") == "true" ?: false
version = "0.9.4"
}
}

tasks.preTagCommit.enabled = false
tasks.updateVersion.enabled = false
tasks.commitNewVersion.enabled = false
7 changes: 2 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '2.4'

services:

rabbitmq:
Expand All @@ -20,12 +18,11 @@ services:
volumes:
- reportportal-database:/var/lib/postgresql/data
restart: on-failure
# If you need to access the DB locally. Could be a security risk to expose DB.
ports:
- "5432:5432"

opensearch:
image: opensearchproject/opensearch:2.11.0
image: opensearchproject/opensearch:2.16.0
restart: always
volumes:
- opensearch:/usr/share/opensearch/data
Expand Down Expand Up @@ -78,4 +75,4 @@ services:
volumes:
reportportal-database:
opensearch:
minio:
minio:
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=5.12.2
version=5.13.0
description=EPAM Report portal. Main API Service
dockerPrepareEnvironment=
dockerJavaOpts=-Xmx1g -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -Djava.security.egd=file:/dev/./urandom
Expand Down
4 changes: 3 additions & 1 deletion project-properties.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ project.ext {
isDebugMode = System.getProperty("DEBUG", "false") == "true"
releaseMode = project.hasProperty("releaseMode")
scriptsUrl = commonScriptsUrl + (releaseMode ? '5.12.0' : 'develop')
migrationsUrl = migrationsScriptsUrl + (releaseMode ? '5.12.0' : 'develop')
migrationsUrl = migrationsScriptsUrl + (releaseMode ? '5.13.0' : 'develop')
//TODO refactor with archive download
testScriptsSrc = [
(migrationsUrl + '/migrations/0_extensions.up.sql') : 'V001__extensions.sql',
Expand Down Expand Up @@ -69,6 +69,8 @@ project.ext {
(migrationsUrl + '/migrations/84_notication_update.up.sql') : 'V084__notication_update.sql',
(migrationsUrl + '/migrations/86_add_retention_policy_launch.up.sql') : 'V086__add_retention_policy_launch.sql',
(migrationsUrl + '/migrations/88_analytics_data_table.up.sql') : 'V088__analytics_data_table.sql',
(migrationsUrl + '/migrations/90_add_user_fields.up.sql') : 'V090__scim_user_fields.sql',
(migrationsUrl + '/migrations/91_settings_users_sso.up.sql') : 'V091__settings_users_sso.sql',
]
excludeTests = ['**/entity/**',
'**/aop/**',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
import javax.xml.bind.DatatypeConverter;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
Expand Down Expand Up @@ -82,7 +84,7 @@ public OAuth2Authentication readAuthentication(String tokenId) {
ApiKey apiKey = apiKeyRepository.findByHash(hashedKey);
if (apiKey != null) {
Optional<ReportPortalUser> user = userRepository.findReportPortalUser(apiKey.getUserId());
if (user.isPresent()) {
if (user.isPresent() && user.get().isEnabled()) {
LocalDate today = LocalDate.now();
if (apiKey.getLastUsedAt() == null || !apiKey.getLastUsedAt().equals(today)) {
apiKeyRepository.updateLastUsedAt(apiKey.getId(), hashedKey, today);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

package com.epam.ta.reportportal.core.admin;

import com.epam.ta.reportportal.commons.ReportPortalUser;
import com.epam.ta.reportportal.model.settings.AnalyticsResource;
import com.epam.ta.reportportal.model.settings.ServerSettingsResource;
import com.epam.ta.reportportal.model.settings.UpdateSettingsRq;
import com.epam.ta.reportportal.ws.reporting.OperationCompletionRS;
import java.util.Map;

Expand All @@ -31,7 +32,7 @@ public interface ServerAdminHandler {
/**
* Get all server settings
*
* @return {@link ServerSettingsResource}
* @return {@link Map}
*/
Map<String, String> getServerSettings();

Expand All @@ -42,4 +43,12 @@ public interface ServerAdminHandler {
* @return Operation results
*/
OperationCompletionRS saveAnalyticsSettings(AnalyticsResource analyticsResource);

/**
* Update server settings
*
* @param request {@link UpdateSettingsRq}
* @return Operation results
*/
OperationCompletionRS updateServerSettings(UpdateSettingsRq request, ReportPortalUser user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,25 @@
package com.epam.ta.reportportal.core.admin;

import static com.epam.ta.reportportal.entity.ServerSettingsConstants.ANALYTICS_CONFIG_PREFIX;
import static com.epam.ta.reportportal.ws.converter.converters.ServerSettingsConverter.TO_RESOURCE;
import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toMap;

import com.epam.reportportal.rules.exception.ErrorType;
import com.epam.reportportal.rules.exception.ReportPortalException;
import com.epam.ta.reportportal.commons.ReportPortalUser;
import com.epam.ta.reportportal.core.events.MessageBus;
import com.epam.ta.reportportal.core.events.activity.SettingsUpdatedEvent;
import com.epam.ta.reportportal.dao.ServerSettingsRepository;
import com.epam.ta.reportportal.entity.ServerSettings;
import com.epam.ta.reportportal.model.settings.AnalyticsResource;
import com.epam.ta.reportportal.model.settings.ServerSettingsResource;
import com.epam.ta.reportportal.model.settings.UpdateSettingsRq;
import com.epam.ta.reportportal.ws.converter.converters.ServerSettingsConverter;
import com.epam.ta.reportportal.ws.reporting.OperationCompletionRS;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
Expand All @@ -36,18 +44,16 @@
* @author Andrei_Ramanchuk
*/
@Service
@RequiredArgsConstructor
public class ServerAdminHandlerImpl implements ServerAdminHandler {

private final ServerSettingsRepository serverSettingsRepository;

@Autowired
public ServerAdminHandlerImpl(ServerSettingsRepository serverSettingsRepository) {
this.serverSettingsRepository = serverSettingsRepository;
}
private final MessageBus messageBus;

@Override
public Map<String, String> getServerSettings() {
return ServerSettingsConverter.TO_RESOURCE.apply(
return ServerSettingsConverter.TO_RESOURCES.apply(
serverSettingsRepository.selectServerSettings());
}

Expand All @@ -73,6 +79,22 @@ public OperationCompletionRS saveAnalyticsSettings(AnalyticsResource analyticsRe
return new OperationCompletionRS("Server Settings were successfully updated.");
}

@Override
public OperationCompletionRS updateServerSettings(UpdateSettingsRq request,
ReportPortalUser user) {
ServerSettings serverSettings = serverSettingsRepository.findByKey(request.getKey())
.orElseThrow(() -> new ReportPortalException(ErrorType.SERVER_SETTINGS_NOT_FOUND,
request.getKey()));
ServerSettingsResource before = TO_RESOURCE.apply(serverSettings);

serverSettings.setValue(request.getValue());
serverSettingsRepository.save(serverSettings);

messageBus.publishActivity(new SettingsUpdatedEvent(before, TO_RESOURCE.apply(serverSettings),
user.getUserId(), user.getUsername()));
return new OperationCompletionRS("Server Settings were successfully updated.");
}

private Map<String, ServerSettings> findServerSettings() {
return serverSettingsRepository.selectServerSettings().stream()
.collect(toMap(ServerSettings::getKey, s -> s, (prev, curr) -> prev));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import com.google.common.collect.ImmutableSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executors;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public ProjectConfigDelegatingSubscriber<LaunchFinishedEvent> launchFinishedDele
LaunchPatternAnalysisRunner patternAnalysisEventHandler,
LaunchNotificationRunner notificationEventHandler) {
return new ProjectConfigDelegatingSubscriber<>(projectConfigProvider,
List.of(autoAnalysisEventHandler,
List.of(patternAnalysisEventHandler,
autoAnalysisEventHandler,
uniqueErrorAnalysisEventHandler,
launchAnalysisFinishEventPublisher,
patternAnalysisEventHandler,
notificationEventHandler
)
);
Expand Down
Loading

0 comments on commit 704c835

Please sign in to comment.