Skip to content

Commit

Permalink
ALFREDOPS-849 add support for alfresco 74
Browse files Browse the repository at this point in the history
  • Loading branch information
hechmi-dammak-xenit committed Sep 12, 2023
1 parent f34a2b2 commit 44dd2bd
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 72 deletions.
59 changes: 33 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,47 @@ name: CI

on:
push:

workflow_dispatch:
env:
ORG_GRADLE_PROJECT_alfresco_nexus_username: ${{ secrets.ALFRESCO_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_alfresco_nexus_password: ${{ secrets.ALFRESCO_NEXUS_PASSWORD }}

GRADLE_OPTS: >-
-Dorg.gradle.project.org.alfresco.maven.nexus.username=${{ secrets.ALFRESCO_NEXUS_USERNAME }}
-Dorg.gradle.project.org.alfresco.maven.nexus.password=${{ secrets.ALFRESCO_NEXUS_PASSWORD }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
distribution: temurin
java-version: 11
- name: Test
run: ./gradlew test
uses: gradle/gradle-build-action@v2
with:
cache-read-only: false
arguments: test
- name: Upload analysis to sonarcloud
uses: gradle/gradle-build-action@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew sonarqube
with:
cache-read-only: false
arguments: sonarqube
integration-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flavour: [ "community", "enterprise" ]
version: [ "61", "62", "70", "71", "72", "73" ]
version: [ "61", "62", "70", "71", "72", "73","74" ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
distribution: temurin
java-version: 11
- name: Login to Docker
env:
Expand All @@ -45,36 +51,37 @@ jobs:
DOCKER_CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }}
DOCKER_CLOUDSMITH_PASSWORD: ${{ secrets.CLOUDSMITH_APIKEY }}
run: |
echo "$DOCKER_HUB_PASSWORD" | docker login hub.xenit.eu --username "$DOCKER_HUB_USER" --password-stdin
echo "$DOCKER_CLOUDSMITH_PASSWORD" | docker login private.docker.xenit.eu --username "$DOCKER_CLOUDSMITH_USER" --password-stdin
- name: Test
run: ./gradlew :integration-tests:alfresco-${{ matrix.flavour }}-${{ matrix.version }}:integrationTest
env:
ORG_GRADLE_PROJECT_xenit_docker_registry_url: ${{ secrets.XENIT_DOCKER_REGISTRY_URL }}
ORG_GRADLE_PROJECT_xenit_docker_registry_username: ${{ secrets.XENIT_DOCKER_REGISTRY_USERNAME }}
ORG_GRADLE_PROJECT_xenit_docker_registry_password: ${{ secrets.XENIT_DOCKER_REGISTRY_PASSWORD }}
- name: Integration Test
uses: gradle/gradle-build-action@v2
with:
cache-read-only: false
arguments: :integration-tests:alfresco-${{ matrix.flavour }}-${{ matrix.version }}:integrationTest
- name: 'Upload Test Reports'
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: test-result
name: test-result-${{ matrix.flavour }}-${{ matrix.version }}
path: /home/runner/**/build/reports
retention-days: 14
publish:
needs: [test, integration-test]
needs: [ test, integration-test ]
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/heads/master') || startswith(github.ref, 'refs/heads/release') }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
distribution: temurin
java-version: 11
- name: Publish
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_GPG_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_GPG_PASSWORD }}
ORG_GRADLE_PROJECT_sonatype_username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_sonatype_password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
run: ./gradlew publish -PsigningKeyId=CDE3528F
uses: gradle/gradle-build-action@v2
with:
cache-read-only: false
arguments: publish -PsigningKeyId=CDE3528F
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Version template:
-->

# Alfred Telemetry Changelog
## [0.10.0] - 2023-08-31
### Added
* Added support for alfresco 7.4 [#146]
## [0.9.3] - 2023-01-13
### Added
* Added TomcatMetrics [#142]
Expand Down
2 changes: 1 addition & 1 deletion alfred-telemetry-solr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ Restart solr.

Following docker images are created following the steps above:

hub.xenit.eu/alfred-telemetry/solr-alfred-telemetry-<solrFlavor>:<version>
private.docker.xenit.eu/alfred-telemetry/solr-alfred-telemetry-<solrFlavor>:<version>

# How to check that it is working

Expand Down
4 changes: 2 additions & 2 deletions alfred-telemetry-solr/alfred-telemetry-solr6/overload.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {
solrVersion = '6.6.5'
assVersion = '2.0.1'
solrBaseImage = 'hub.xenit.eu/public/alfresco-solr6:2.0.1'
assVersion = '2.0.6'
solrBaseImage = 'docker.io/xenit/alfresco-solr6:2.0.6'
solrFlavor = 'solr6'
}
2 changes: 1 addition & 1 deletion alfred-telemetry-solr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ subprojects {
dockerFile {
dockerFile = createDockerFile.getDestFile()
dockerBuild {
repository = "hub.xenit.eu/alfred-telemetry/solr-alfred-telemetry-${solrFlavor}"
repository = "private.docker.xenit.eu/alfred-telemetry/solr-alfred-telemetry-${solrFlavor}"
automaticTags = false
tags = ["${version}"]
}
Expand Down
14 changes: 1 addition & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@ sonarqube {
}
}

def copyPropertyValueIfExists(sourcePropertyName, targetPropertyName) {
if (project.hasProperty(sourcePropertyName)) {
project.ext[targetPropertyName] = project.property(sourcePropertyName)
}
}

allprojects {
group = 'eu.xenit.alfred.telemetry'
version = '0.9.3'
version = '0.10.0'

apply plugin: 'java'
apply plugin: 'jacoco'
Expand Down Expand Up @@ -50,13 +45,6 @@ allprojects {
restAssuredVersion = '4.0.0'
}

// It is not possible to set properties with a dot via GitHub Actions env variables, therefore we introduce support
// for a non-dotted-equivalent
copyPropertyValueIfExists('alfresco_nexus_username', 'org.alfresco.maven.nexus.username')
copyPropertyValueIfExists('alfresco_nexus_password', 'org.alfresco.maven.nexus.password')
copyPropertyValueIfExists('xenit_docker_registry_url', 'eu.xenit.docker.registry.url')
copyPropertyValueIfExists('xenit_docker_registry_username', 'eu.xenit.docker.registry.username')
copyPropertyValueIfExists('xenit_docker_registry_password', 'eu.xenit.docker.registry.password')

repositories {
mavenCentral()
Expand Down
17 changes: 17 additions & 0 deletions integration-tests/alfresco-community-74/overload.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ext {
alfrescoBaseWarBom = 'org.alfresco:acs-community-packaging:7.4.0'
alfrescoBaseWar = 'org.alfresco:content-services-community@war'
alfrescoBaseImage = 'xenit/alfresco-repository-community:7.4.0'
solrFlavor = 'solr6'

// postgresImage = 'postgres:13'

extraDependencies = [
"io.micrometer:micrometer-core:${micrometerVersion}",
"io.github.mweirauch:micrometer-jvm-extras:${jvmExtrasVersion}",

"io.micrometer:micrometer-registry-graphite:${micrometerVersion}",
"io.micrometer:micrometer-registry-jmx:${micrometerVersion}",
"io.micrometer:micrometer-registry-prometheus:${micrometerVersion}"
]
}
8 changes: 8 additions & 0 deletions integration-tests/alfresco-enterprise-74/overload.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ext {
alfrescoBaseWarBom = 'org.alfresco:acs-packaging:7.4.0.1'
alfrescoBaseWar = 'org.alfresco:content-services@war'

alfrescoBaseImage = 'private.docker.xenit.eu/alfresco-enterprise/alfresco-repository-enterprise:7.4.0.1'

solrFlavor = 'solr6'
}
2 changes: 1 addition & 1 deletion integration-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ subprojects {
leanImage = true

dockerBuild {
repository = "hub.xenit.eu/alfred-telemetry/alfresco-alfred-telemetry-${alfrescoVersion}"
repository = "private.docker.xenit.eu/alfred-telemetry/alfresco-alfred-telemetry-${alfrescoVersion}"
tags = ["${version}"]
automaticTags = false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package eu.xenit.alfred.telemetry.integrationtesting;

import static io.restassured.RestAssured.given;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.isOneOf;

import io.restassured.response.ExtractableResponse;
import io.restassured.response.Response;
import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Test;

public class AlfrescoPrometheusEndpointTest extends RestAssuredTest {
import static io.restassured.RestAssured.given;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;

class AlfrescoPrometheusEndpointTest extends RestAssuredTest {

@Test
void alfrescoEndpointExposesAlfredTelemetryMetrics() {
Expand All @@ -21,17 +20,17 @@ void alfrescoEndpointExposesAlfredTelemetryMetrics() {
// ERROR: cannot execute nextval() in a read-only transaction
given().when().get("s/prometheus");
// Actual test
//enterprise will return 200 and community will not have this endpoint
ExtractableResponse<Response> response =
given()
.log().ifValidationFails()
.when()
.get("s/prometheus")
.then()
.log().ifValidationFails()
.statusCode(isOneOf(getExpectedStatusCode()))
.statusCode(getExpectedStatusCode())
.extract();

if(getExpectedStatusCode() != HttpStatus.SC_OK) {
if (getExpectedStatusCode() != HttpStatus.SC_OK) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: '3.2'

services:
grafana:
image: hub.xenit.eu/public/grafana:5
image: grafana/grafana
volumes:
- ./grafana:/etc/grafana:z
ports:
- 3000:3000
- "3000:3000"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- 9090:9090
- "9090:9090"

grafana:
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- 9090:9090
- "9090:9090"

grafana:
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- 9090:9090
- "9090:9090"

grafana:
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- DYNAMIC_SHARD_REGISTRATION=true

solr1:
image: hub.xenit.eu/alfresco-enterprise/alfresco-solr6:1.3
image: private.docker.xenit.eu/alfresco-enterprise/alfresco-solr6:2.0.6
restart: unless-stopped
ports:
- 8080
Expand All @@ -25,7 +25,7 @@ services:
- GLOBAL_alfresco-1_shard.instance=1

solr2:
image: hub.xenit.eu/alfresco-enterprise/alfresco-solr6:1.3
image: private.docker.xenit.eu/alfresco-enterprise/alfresco-solr6:2.0.6
restart: unless-stopped
ports:
- 8080
Expand Down
15 changes: 4 additions & 11 deletions integration-tests/src/test/resources/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,18 @@ services:
alfresco:
image: ${DOCKER_IMAGE}
ports:
- target: 8080
mode: host
- target: 8443
mode: host
# - target: 8000
# mode: host
# published: 8000
# - target: 5000
# mode: host
# published: 5000
- "8080:8080"
- "8443:8443"
environment:
- DEBUG=true
- JMX_ENABLED=true
- INDEX=noindex
- ENABLE_CLUSTERING=true
- GLOBAL_metrics.enabled=true
- GLOBAL_alfred.telemetry.alfresco-integration.enabled=true
# Expose AT metrics in the Alfresco endpoint:
# Expose AT metrics in the Alfresco endpoint:
- GLOBAL_alfred.telemetry.alfresco-integration.use-default-alfresco-registry=true
- GLOBAL_metrics.tomcatMetricsReporter.enabled=true
# Enable Alfresco cache metrics:
- GLOBAL_alfred.telemetry.binder.cache.enabled=true

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include ':alfred-telemetry-solr'

include ':integration-tests'

def integrationTestVersions = ["61", "62", "70","71","72","73"];
def integrationTestVersions = ["61", "62", "70","71","72","73","74"];

if (!hasProperty("community")) {
integrationTestVersions.each { version ->
Expand Down

0 comments on commit 44dd2bd

Please sign in to comment.