From 66a1f1379ebb64407207e591ba4f5a795c08bb97 Mon Sep 17 00:00:00 2001 From: Zlatin Todorinski <6491638+todorinskiz@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:32:12 +0100 Subject: [PATCH] XENOPS-1201 Dropped Alfresco 5 and 6; Added Alfresco 7.1, 7.2, 7.3, 7.4; Dropped secret in favor of TLS; Dropped obsolete Jar shadowing; Dropped obsolete boms; Fixed log4j2 bug (limited to docker compose and minimal log4j2.properties config; Fixed bug in integration test where files used for testing were no longer available; --- .github/workflows/ci.yml | 5 +- CHANGELOG.md | 11 ++- README.md | 9 +- .../log4j2.properties | 7 ++ .../default/healthprocessor.properties | 4 +- .../default/plugin-context.xml | 3 +- .../plugins/solr/SolrRequestExecutor.java | 20 +++-- .../plugins/solr/SslHttpClientFactory.java | 84 +++++++++++++++++++ .../plugins/solr/SolrRequestExecutorTest.java | 25 +++--- build.gradle | 20 +++-- gradle.properties | 8 +- .../alfresco-community-70/overload.gradle | 6 -- .../alfresco-enterprise-70/overload.gradle | 6 -- integration-tests/build.gradle | 19 ++++- .../default/test-webscripts-context.xml | 1 + .../healthprocessor/solr/NodeFinder.java | 2 +- .../solr/SolrNodeHandlerWebScript.java | 20 +++-- .../solr/SolrPurgeNodeWebScript.java | 7 +- .../test/resources/compose/docker-compose.yml | 45 +++++++++- settings.gradle | 2 +- 20 files changed, 235 insertions(+), 69 deletions(-) create mode 100644 alfresco-health-processor-platform/src/main/amp/config/alfresco/module/alfresco-health-processor/log4j2.properties create mode 100644 alfresco-health-processor-platform/src/main/java/eu/xenit/alfresco/healthprocessor/plugins/solr/SslHttpClientFactory.java delete mode 100644 integration-tests/alfresco-community-70/overload.gradle delete mode 100644 integration-tests/alfresco-enterprise-70/overload.gradle diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0248d64..928a14b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,11 +32,12 @@ jobs: run: ./gradlew javadoc integration-test: runs-on: ubuntu-latest - if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' || startsWith(github.ref, 'refs/tags/') }} + # Disable temporarily + # if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' || startsWith(github.ref, 'refs/tags/') }} strategy: matrix: flavour: [ "community" ] ## , "enterprise" - version: [ "70", "71", "72", "73", "74" ] + version: [ "71", "72", "73", "74" ] steps: - uses: actions/checkout@v4 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 5477f552..a2251a60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ --- title: Changelog - Alfred Health Processor -date: 19 December 2024 +date: 20 December 2024 report: true colorlinks: true --- @@ -22,6 +22,15 @@ Version template: # Alfresco Health Processor Changelog +## [0.6.0] - UNRELEASED + +### Added +* Alfresco 7.1, 7.2, 7.3, 7.4 support + +### Removed +* Alfresco 5 & 6 support + + ## [0.5.6] - 2024-12-19 ### Fixed diff --git a/README.md b/README.md index 18d2e9de..946a1f0a 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,9 @@ eu.xenit.alfresco.healthprocessor.plugin.content-validation.properties=cm:conten If this property is not set (which is the default), the plugin will request all properties of type `d:content` from Alfresco's `DictionaryService`. +When validating content, "NONE" in the reporting means, there is no status for a certain document, because it was not checked. +For example, content checks report nodes without any content property as none. + #### Solr index Validation Activation property: `eu.xenit.alfresco.healthprocessor.plugin.solr-index.enabled=true` @@ -286,7 +289,11 @@ Activation property: `eu.xenit.alfresco.healthprocessor.reporter.log.summary.ena A simple implementation that writes, once a Health Processor cycle is completed, a summary and unhealthy nodes to the Alfresco logs. -Relevant logger: `log4j.logger.eu.xenit.alfresco.healthprocessor.reporter.log.SummaryLoggingHealthReporter=INFO` +> [!WARNING] +> Starting from alfresco 7.4, alfresco has migrated to log4j2. The original log4j logger will no longer exist. + +Relevant logger (log4j) (pre Alfresco 7.3): `log4j.logger.eu.xenit.alfresco.healthprocessor.reporter.log.SummaryLoggingHealthReporter=INFO` +Relevant logger (log4j2): `logger.eu_xenit_alfresco_healthprocessor.name=eu.xenit.alfresco.healthprocessor` Example output: diff --git a/alfresco-health-processor-platform/src/main/amp/config/alfresco/module/alfresco-health-processor/log4j2.properties b/alfresco-health-processor-platform/src/main/amp/config/alfresco/module/alfresco-health-processor/log4j2.properties new file mode 100644 index 00000000..e0d8567d --- /dev/null +++ b/alfresco-health-processor-platform/src/main/amp/config/alfresco/module/alfresco-health-processor/log4j2.properties @@ -0,0 +1,7 @@ +logger.eu_xenit_alfresco_healthprocessor.name=eu.xenit.alfresco.healthprocessor +logger.eu_xenit_alfresco_healthprocessor.level=info +logger.eu_xenit_alfresco_healthprocessor_indexing.name=eu.xenit.alfresco.healthprocessor.indexing +logger.eu_xenit_alfresco_healthprocessor_fixer.name=eu.xenit.alfresco.healthprocessor.fixer +logger.eu_xenit_alfresco_healthprocessor_plugins.name=eu.xenit.alfresco.healthprocessor.plugins +logger.eu_xenit_alfresco_healthprocessor_processing.name=eu.xenit.alfresco.healthprocessor.processing +logger.eu_xenit_alfresco_healthprocessor_reporter.name=eu.xenit.alfresco.healthprocessor.reporter diff --git a/alfresco-health-processor-platform/src/main/amp/config/alfresco/subsystems/HealthProcessor/default/healthprocessor.properties b/alfresco-health-processor-platform/src/main/amp/config/alfresco/subsystems/HealthProcessor/default/healthprocessor.properties index 70f8d855..bb7d546f 100644 --- a/alfresco-health-processor-platform/src/main/amp/config/alfresco/subsystems/HealthProcessor/default/healthprocessor.properties +++ b/alfresco-health-processor-platform/src/main/amp/config/alfresco/subsystems/HealthProcessor/default/healthprocessor.properties @@ -24,11 +24,11 @@ eu.xenit.alfresco.healthprocessor.plugin.solr-index.enabled=false eu.xenit.alfresco.healthprocessor.plugin.solr-index.check-transaction=false eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints=default,archive eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints.default.type=Always -eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints.default.base-uri=http://${solr.host}:${solr.port}/solr/alfresco +eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints.default.base-uri=https://${solr.host}:${solr.port.ssl}/solr/alfresco eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints.default.indexed-store=workspace://SpacesStore eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints.archive.type=Always -eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints.archive.base-uri=http://${solr.host}:${solr.port}/solr/archive +eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints.archive.base-uri=https://${solr.host}:${solr.port.ssl}/solr/archive eu.xenit.alfresco.healthprocessor.plugin.solr-index.endpoints.archive.indexed-store=archive://SpacesStore eu.xenit.alfresco.healthprocessor.reporter.store.max-stored-reports=3000 diff --git a/alfresco-health-processor-platform/src/main/amp/config/alfresco/subsystems/HealthProcessor/default/plugin-context.xml b/alfresco-health-processor-platform/src/main/amp/config/alfresco/subsystems/HealthProcessor/default/plugin-context.xml index e2a2014f..673351b7 100644 --- a/alfresco-health-processor-platform/src/main/amp/config/alfresco/subsystems/HealthProcessor/default/plugin-context.xml +++ b/alfresco-health-processor-platform/src/main/amp/config/alfresco/subsystems/HealthProcessor/default/plugin-context.xml @@ -36,7 +36,8 @@ - + + true) // Use default trust strategy + .build(); + + // Create the SSLConnectionSocketFactory with the SSLContext + SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory( + sslContext, + new String[]{"TLSv1.2","TLSv1.3"}, // Allowed TLS protocols + null, // Default cipher suites + NoopHostnameVerifier.INSTANCE + ); + return HttpClientBuilder.create() + .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .setSSLSocketFactory(sslSocketFactory) + .build(); + } catch (IOException | CertificateException | KeyManagementException | UnrecoverableKeyException | + KeyStoreException | NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + private static Object getKeystorePassword(File keystoreParentLocation) throws IOException { + Properties p = new Properties(); + p.load(new FileInputStream(keystoreParentLocation.getAbsolutePath() + + "/ssl-keystore-passwords.properties")); + return p.get("keystore.password"); + } + + private static Object getTruststorePassword(File keystoreParentLocation) throws IOException { + Properties p = new Properties(); + p.load(new FileInputStream(keystoreParentLocation.getAbsolutePath() + + "/ssl-truststore-passwords.properties")); + return p.get("keystore.password"); + } +} diff --git a/alfresco-health-processor-platform/src/test/java/eu/xenit/alfresco/healthprocessor/plugins/solr/SolrRequestExecutorTest.java b/alfresco-health-processor-platform/src/test/java/eu/xenit/alfresco/healthprocessor/plugins/solr/SolrRequestExecutorTest.java index c4ecf8b2..078f3e05 100644 --- a/alfresco-health-processor-platform/src/test/java/eu/xenit/alfresco/healthprocessor/plugins/solr/SolrRequestExecutorTest.java +++ b/alfresco-health-processor-platform/src/test/java/eu/xenit/alfresco/healthprocessor/plugins/solr/SolrRequestExecutorTest.java @@ -1,15 +1,17 @@ package eu.xenit.alfresco.healthprocessor.plugins.solr; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - import com.github.paweladamski.httpclientmock.HttpClientMock; -import eu.xenit.alfresco.healthprocessor.plugins.solr.SolrRequestExecutor.SolrNodeCommand; import eu.xenit.alfresco.healthprocessor.plugins.solr.SolrRequestExecutor.SolrActionResponse; +import eu.xenit.alfresco.healthprocessor.plugins.solr.SolrRequestExecutor.SolrNodeCommand; import eu.xenit.alfresco.healthprocessor.plugins.solr.endpoint.SearchEndpoint; import eu.xenit.alfresco.healthprocessor.util.SetUtil; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeRef.Status; +import org.alfresco.service.cmr.repository.StoreRef; +import org.apache.http.client.HttpResponseException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import java.io.IOException; import java.net.URI; import java.util.ArrayList; @@ -17,12 +19,11 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeRef.Status; -import org.alfresco.service.cmr.repository.StoreRef; -import org.apache.http.client.HttpResponseException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; class SolrRequestExecutorTest { diff --git a/build.gradle b/build.gradle index 212dbefa..9128925e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,9 @@ plugins { id 'eu.xenit.alfresco' version '1.2.0' apply(false) id 'eu.xenit.docker-alfresco' version '5.5.0' apply(false) - id "org.sonarqube" version "3.3" - id "org.kordamp.gradle.jacoco" version "0.47.0" + id "org.sonarqube" version "5.1.0.4882" + id "org.kordamp.gradle.jacoco" version "0.54.0" + id "be.vbgn.ci-detect" version "0.5.0" } //description = "Alfresco Health Processor: A background processor capable of performing various operations on the nodes in your Alfresco repository, in a batched and controlled manner" @@ -13,16 +14,17 @@ sonarqube { property "sonar.organization", "xenit-eu" property "sonar.host.url", "https://sonarcloud.io" property "sonar.coverage.exclusions", "**/eu/xenit/alfresco/healthprocessor/example/*" + if (ci.isPullRequest()) { + property "sonar.pullrequest.key", ci.pullRequest + property "sonar.pullrequest.branch", ci.branch + property "sonar.pullrequest.base", ci.pullRequestTargetBranch + } else { + // GIT_BRANCH allows to push from local development directly to SonarCloud + property "sonar.branch.name", ci.reference != null ? ci.reference : "$System.env.GIT_BRANCH" + } } } -ext { - alfrescoVersion = '7.0.0' - alfredTelemetryVersion = '0.6.0' - micrometerVersion = '1.0.6' - lombokVersion = '1.18.36' -} - subprojects { plugins.withType(JavaBasePlugin) { diff --git a/gradle.properties b/gradle.properties index be1824bd..44e0b210 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,7 @@ -reckon.scope=patch \ No newline at end of file +reckon.scope=patch +alfrescoVersion=7.1.0 +alfredTelemetryVersion=0.10.1 +micrometerVersion=1.0.6 +jvmExtrasVersion=0.1.2 +lombokVersion=1.18.36 +ootbVersion=1.2.2.0 diff --git a/integration-tests/alfresco-community-70/overload.gradle b/integration-tests/alfresco-community-70/overload.gradle deleted file mode 100644 index 85225699..00000000 --- a/integration-tests/alfresco-community-70/overload.gradle +++ /dev/null @@ -1,6 +0,0 @@ -ext { - alfrescoVersion = '7.0.0' - alfrescoBaseWarBom = "org.alfresco:acs-community-packaging:${alfrescoVersion}" - alfrescoBaseWar = 'org.alfresco:content-services-community@war' - alfrescoBaseImage = "docker.io/xenit/alfresco-repository-community:${alfrescoVersion.substring(0,3)}" -} diff --git a/integration-tests/alfresco-enterprise-70/overload.gradle b/integration-tests/alfresco-enterprise-70/overload.gradle deleted file mode 100644 index a02ba191..00000000 --- a/integration-tests/alfresco-enterprise-70/overload.gradle +++ /dev/null @@ -1,6 +0,0 @@ -ext { - alfrescoVersion = '7.0.0' - alfrescoBaseWarBom = "org.alfresco:acs-packaging:${alfrescoVersion}" - alfrescoBaseWar = 'org.alfresco:content-services@war' - alfrescoBaseImage = "docker.io/xenit/alfresco-repository-skeleton:${alfrescoVersion.substring(0,3)}" -} diff --git a/integration-tests/build.gradle b/integration-tests/build.gradle index 1510ed41..9170d162 100644 --- a/integration-tests/build.gradle +++ b/integration-tests/build.gradle @@ -10,7 +10,6 @@ ext { dependencies { alfrescoProvided project(":alfresco-health-processor-platform") -// alfrescoProvided(enforcedPlatform("eu.xenit.alfresco:alfresco-community-bom:${alfrescoVersion}")) alfrescoProvided platform("org.alfresco:acs-community-packaging:${alfrescoVersion}") alfrescoProvided("org.alfresco:alfresco-repository") { exclude module: 'spring-social-facebook-web' @@ -23,9 +22,6 @@ dependencies { testImplementation "org.hamcrest:hamcrest-all:${hamcrestVersion}" testImplementation "io.rest-assured:rest-assured:${restAssuredVersion}" testImplementation "org.awaitility:awaitility:${awaitilityVersion}" - - testImplementation group: 'org.slf4j', name: 'slf4j-api', version: "${slf4jVersion}" - testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: "${slf4jVersion}" } test { @@ -60,6 +56,12 @@ subprojects { Project p -> apply plugin: 'eu.xenit.docker-alfresco' apply plugin: 'eu.xenit.docker-compose.auto' + configurations { + all { + exclude group: 'org.slf4j' + } + } + dependencies { if (project.hasProperty("alfrescoBaseWarBom")) { baseAlfrescoWar platform("${alfrescoBaseWarBom}") @@ -68,7 +70,16 @@ subprojects { Project p -> alfrescoAmp project(path: ":integration-tests", configuration: "amp") alfrescoAmp project(path: ":alfresco-health-processor-platform", configuration: "amp") alfrescoAmp "eu.xenit.alfred.telemetry:alfred-telemetry-platform:${alfredTelemetryVersion}@amp" + + alfrescoAmp("org.orderofthebee.support-tools:support-tools-repo:${ootbVersion}:amp@amp") alfrescoSM(group: 'org.postgresql', name: 'postgresql', version: '42.6.0') + + alfrescoSM "io.micrometer:micrometer-core:${micrometerVersion}" + alfrescoSM "io.github.mweirauch:micrometer-jvm-extras:${jvmExtrasVersion}" + + alfrescoSM "io.micrometer:micrometer-registry-graphite:${micrometerVersion}" + alfrescoSM "io.micrometer:micrometer-registry-jmx:${micrometerVersion}" + alfrescoSM "io.micrometer:micrometer-registry-prometheus:${micrometerVersion}" } dockerBuild { diff --git a/integration-tests/src/main/amp/config/alfresco/extension/subsystems/HealthProcessor/default/default/test-webscripts-context.xml b/integration-tests/src/main/amp/config/alfresco/extension/subsystems/HealthProcessor/default/default/test-webscripts-context.xml index 1704a76d..76d32f58 100644 --- a/integration-tests/src/main/amp/config/alfresco/extension/subsystems/HealthProcessor/default/default/test-webscripts-context.xml +++ b/integration-tests/src/main/amp/config/alfresco/extension/subsystems/HealthProcessor/default/default/test-webscripts-context.xml @@ -22,6 +22,7 @@ parent="webscript"> + include ":integration-tests:alfresco-community-${version}"