Skip to content

Commit df7937b

Browse files
DOCKER-442 fix solr backup numberToLive
* DOCKER-442 fix solr backup numberToLive * DOCKER-442 add time to live integration test
1 parent 151713e commit df7937b

File tree

17 files changed

+341
-194
lines changed

17 files changed

+341
-194
lines changed
File renamed without changes.

.github/workflows/ci.yml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ on:
33
push:
44
workflow_dispatch:
55
env:
6-
ORG_GRADLE_PROJECT_alfresco_nexus_username: ${{ secrets.ALFRESCO_NEXUS_USERNAME }}
7-
ORG_GRADLE_PROJECT_alfresco_nexus_password: ${{ secrets.ALFRESCO_NEXUS_PASSWORD }}
6+
GRADLE_OPTS: >-
7+
-Dorg.gradle.project.org.alfresco.maven.nexus.username=${{ secrets.ALFRESCO_NEXUS_USERNAME }}
8+
-Dorg.gradle.project.org.alfresco.maven.nexus.password=${{ secrets.ALFRESCO_NEXUS_PASSWORD }}
89
jobs:
9-
integration-tests:
10+
test:
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v2
@@ -15,24 +16,41 @@ jobs:
1516
- uses: actions/setup-java@v1
1617
with:
1718
java-version: 11
18-
- name: Login to Docker
19-
run: |
20-
echo "${{ secrets.CLOUDSMITH_APIKEY }}" | docker login private.docker.xenit.eu --username "${{ secrets.CLOUDSMITH_USER }}" --password-stdin
21-
- name: Test
19+
- name: Integration test
2220
uses: gradle/gradle-build-action@v2
2321
with:
2422
cache-read-only: false
25-
arguments: |
26-
integration-tests:solr6:integrationTest
23+
arguments: test -x :integration-tests:test
2724
- name: Upload Test Artifact
2825
if: success() || failure()
2926
uses: actions/upload-artifact@v3
3027
with:
3128
name: test-result
3229
path: /home/runner/work/**/build/reports
3330
retention-days: 2
31+
integration-test:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v2
35+
with:
36+
fetch-depth: 0
37+
- uses: actions/setup-java@v1
38+
with:
39+
java-version: 11
40+
- name: Integration test
41+
uses: gradle/gradle-build-action@v2
42+
with:
43+
cache-read-only: false
44+
arguments: integration-tests:test
45+
- name: Upload Test Artifact
46+
if: success() || failure()
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: integration-test-result
50+
path: /home/runner/work/**/build/reports
51+
retention-days: 2
3452
publish:
35-
needs: [ integration-tests ]
53+
needs: [ test, integration-test ]
3654
runs-on: ubuntu-latest
3755
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
3856
steps:
@@ -53,5 +71,4 @@ jobs:
5371
ORG_GRADLE_PROJECT_sonatype_password: ${{ secrets.SONATYPE_S01_PASSWORD }}
5472
with:
5573
cache-read-only: false
56-
arguments: |
57-
publish -PsigningKeyId=CDE3528F -i
74+
arguments: publish -PsigningKeyId=CDE3528F -i

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
title: Changelog - Solr Backup
33

44
# Alfresco Backup Changelog
5+
## v0.0.9 - 28-11-2023
6+
7+
* DOCKER-442 fix solr backup numberToLive
8+
9+
## v0.0.8 - 20-11-2023
10+
11+
* DOCKER-441 improve solr backup documentation and add new env
12+
513
## v0.0.5 - 3-11-2023
614

715
* OUPDAUNTLE-54 drop aws keys and use integrated env variables

README.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,44 @@ Integration tests follow the same line:
2525
* trigger a restore /solr/alfresco/replication?command=restore&repository=s3&location=s3:///
2626
* check if the restore was successful in a certain timeout (3 minutes) by following the output of
2727
/solr/alfresco/replication?command=restorestatus
28+
## Setup
29+
30+
you need to put the solr.xml file under /opt/alfresco-search-services/solrhome/
31+
```
32+
<?xml version='1.0' encoding='UTF-8'?>
33+
<solr>
34+
<str name="adminHandler">${adminHandler:org.alfresco.solr.AlfrescoCoreAdminHandler}</str>
35+
<backup>
36+
<repository name="s3" class="eu.xenit.solr.backup.s3.S3BackupRepository" default="false">
37+
<str name="s3.bucket.name">${S3_BUCKET_NAME:}</str>
38+
<str name="s3.endpoint">${S3_ENDPOINT:http://s3.eu-central-1.amazonaws.com}</str>
39+
<str name="s3.region">${S3_REGION:eu-central-1}</str>
40+
<str name="s3.access.key">${S3_ACCESS_KEY:}</str>
41+
<str name="s3.secret.key">${S3_SECRET_KEY:}</str>
42+
<str name="s3.proxy.host">${S3_PROXY_HOST:}</str>
43+
<int name="s3.proxy.port">${S3_PROXY_PORT:0}</int>
44+
<bool name="s3.path.style.access.enabled">${S3_PATH_STYLE_ACCESS_ENABLED:false}</bool>
45+
</repository>
46+
</backup>
47+
</solr>
48+
```
49+
50+
and specify the Environment or Java variables
2851

2952
## Variables
3053

3154
all of these variable can be set as environment variable or as a system property so that it is substituted in solr.xml
3255

33-
| Environment variable | Java system property | Default | required |
34-
|----------------------|----------------------|--------------------------------------|----------|
35-
| S3_ENDPOINT | -DS3_ENDPOINT | http://s3.eu-central-1.amazonaws.com | false |
36-
| S3_BUCKET_NAME | -DS3_BUCKET_NAME | | true |
37-
| S3_REGION | -DS3_REGION | eu-central-1 | false |
38-
| S3_ACCESS_KEY | -DS3_ACCESS_KEY | | false |
39-
| S3_SECRET_KEY | -DS3_SECRET_KEY | | false |
40-
| S3_PROXY_HOST | -DS3_PROXY_HOST | | false |
41-
| S3_PROXY_PORT | -DS3_PROXY_PORT | | false |
56+
| Environment variable | Java system property | Default | required |
57+
|------------------------------|--------------------------------|--------------------------------------|----------|
58+
| S3_ENDPOINT | -DS3_ENDPOINT | http://s3.eu-central-1.amazonaws.com | false |
59+
| S3_BUCKET_NAME | -DS3_BUCKET_NAME | | true |
60+
| S3_REGION | -DS3_REGION | eu-central-1 | false |
61+
| S3_ACCESS_KEY | -DS3_ACCESS_KEY | | false |
62+
| S3_SECRET_KEY | -DS3_SECRET_KEY | | false |
63+
| S3_PROXY_HOST | -DS3_PROXY_HOST | | false |
64+
| S3_PROXY_PORT | -DS3_PROXY_PORT | | false |
65+
| S3_PATH_STYLE_ACCESS_ENABLED | -DS3_PATH_STYLE_ACCESS_ENABLED | false | false |
4266

4367
## Testing against DataCore Swarm docker
4468

build.gradle

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,11 @@ plugins {
33
id 'eu.xenit.docker-compose' version '5.4.0' apply false
44
}
55

6-
def copyPropertyValueIfExists(sourcePropertyName, targetPropertyName) {
7-
if (project.hasProperty(sourcePropertyName)) {
8-
project.ext[targetPropertyName] = project.property(sourcePropertyName)
9-
}
10-
}
11-
126
subprojects {
137
apply plugin: 'java'
148
def baseVersion = System.getenv("TAG_VERSION") ?: 'v0.0.6'
159
version = baseVersion[1..baseVersion.length() - 1]
1610

17-
// It is not possible to set properties with a dot via GitHub Actions env variables, therefore we introduce support
18-
// for a non-dotted-equivalent
19-
copyPropertyValueIfExists('alfresco_nexus_username', 'org.alfresco.maven.nexus.username')
20-
copyPropertyValueIfExists('alfresco_nexus_password', 'org.alfresco.maven.nexus.password')
21-
2211
repositories {
2312
mavenCentral()
2413
maven {

gradle.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
junitJupiterVersion=5.4.2
2+
mockitoVersion=2.27.0
3+
solrVersion=6.6.5
4+
assVersion=2.0.8.2
5+
amazonVersion=1.12.32
6+
jaxBVersion=2.3.2
7+
restAssuredVersion=4.0.0
8+
awaitablityVersion=4.2.0

integration-tests/build.gradle

Lines changed: 44 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,60 @@
1-
plugins {
2-
id 'java'
3-
id 'idea'
1+
apply plugin: 'java'
2+
apply plugin: 'idea'
3+
apply plugin: 'eu.xenit.docker'
4+
apply plugin: 'eu.xenit.docker-compose.auto'
5+
6+
ext {
7+
solrVersion = '6.6.5'
8+
assVersion = '2.0.6'
9+
solrBaseImage = 'docker.io/xenit/alfresco-solr6-xenit:2.0.6'
10+
alfrescoimage = 'docker.io/xenit/alfresco-repository-community:7.3.0'
11+
flavor = 'solr6'
412
}
513

6-
dependencies {
7-
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '3.0.1'
8-
testImplementation group: 'io.rest-assured', name: 'json-path', version: '3.0.1'
9-
testImplementation group: 'io.rest-assured', name: 'rest-assured-common', version: '3.0.1'
10-
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.4.2"
11-
testImplementation "org.junit.jupiter:junit-jupiter-params:5.4.2"
1214

13-
testRuntimeOnly group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.2'
14-
}
15+
description = "Solr ${flavor} with backup"
1516

16-
test {
17-
enabled = false
18-
useJUnitPlatform()
19-
testLogging {
20-
events "passed", "skipped", "failed"
21-
}
17+
configurations {
18+
backupJar
2219
}
2320

24-
subprojects {
25-
apply plugin: 'java'
26-
apply plugin: 'eu.xenit.docker'
27-
apply plugin: 'eu.xenit.docker-compose.auto'
28-
apply from: "${project.projectDir}/overload.gradle"
29-
30-
description = "Solr ${flavor} with backup"
31-
32-
configurations {
33-
amazonSdkCore
34-
amazonSdkS3
35-
backupJar
36-
}
37-
38-
dependencies {
39-
amazonSdkCore group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.12.32', ext: 'jar'
40-
amazonSdkS3 group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.12.32', ext: 'jar'
21+
dependencies {
22+
backupJar project(path: ":solr-backup")
4123

42-
backupJar project(path: ":solr-backup")
43-
}
24+
testImplementation "io.rest-assured:rest-assured:${restAssuredVersion}"
25+
testImplementation "io.rest-assured:json-path:${restAssuredVersion}"
26+
testImplementation "io.rest-assured:rest-assured-common:${restAssuredVersion}"
27+
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
28+
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitJupiterVersion}"
29+
testImplementation "org.awaitility:awaitility:${awaitablityVersion}"
4430

31+
testImplementation platform("com.amazonaws:aws-java-sdk-bom:${amazonVersion}")
4532

46-
task integrationTest(type: Test, group: "verification") {
47-
useJUnitPlatform()
48-
testClassesDirs = project.parent.sourceSets.test.output.classesDirs
49-
classpath = project.parent.sourceSets.test.runtimeClasspath
50-
outputs.upToDateWhen { false }
51-
}
33+
testImplementation('com.amazonaws:aws-java-sdk-core')
34+
testImplementation('com.amazonaws:aws-java-sdk-s3')
35+
testImplementation("com.amazonaws:aws-java-sdk-sts")
5236

37+
testRuntimeOnly "org.glassfish.jaxb:jaxb-runtime:${jaxBVersion}"
38+
}
39+
test {
40+
useJUnitPlatform()
41+
}
5342

54-
createDockerFile {
55-
from "${solrBaseImage}"
43+
createDockerFile {
44+
from "${solrBaseImage}"
5645

57-
dependsOn(configurations.backupJar)
46+
dependsOn(configurations.backupJar)
5847

59-
if (flavor == "solr6") {
60-
smartCopy "${project.parent.projectDir}/src/test/resources/solr.xml", "/opt/alfresco-search-services/solrhome/solr.xml"
61-
smartCopy configurations.backupJar, "/opt/alfresco-search-services/solrhome/lib/"
62-
smartCopy configurations.amazonSdkCore.singleFile, "/opt/alfresco-search-services/solrhome/lib/"
63-
smartCopy configurations.amazonSdkS3.singleFile, "/opt/alfresco-search-services/solrhome/lib/"
64-
}
48+
if (flavor == "solr6") {
49+
smartCopy "${project.projectDir}/src/test/resources/solr.xml", "/opt/alfresco-search-services/solrhome/solr.xml"
50+
smartCopy configurations.backupJar, "/opt/alfresco-search-services/solrhome/lib/"
6551
}
52+
}
6653

67-
dockerCompose {
68-
environment.put 'ALFRESCO_IMAGE', project.alfrescoimage
69-
useComposeFiles = [
70-
"${project.parent.projectDir}/src/test/resources/compose/docker-compose.yml"
71-
]
72-
isRequiredBy(project.tasks.integrationTest)
73-
}
54+
dockerCompose {
55+
environment.put 'ALFRESCO_IMAGE', project.alfrescoimage
56+
useComposeFiles = [
57+
"${project.projectDir}/src/test/resources/compose/docker-compose.yml"
58+
]
59+
isRequiredBy(project.tasks.test)
7460
}

integration-tests/solr6/overload.gradle

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)