Skip to content

Commit 16c9750

Browse files
authored
SONARPY-2471: Orchestrator cache should be cleaned up when using the DEV version (#2254)
1 parent d53b19b commit 16c9750

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

.cirrus.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ plugin_qa_task:
163163
<<: *ONLY_SONARSOURCE_QA
164164
eks_container:
165165
<<: *QA_CONTAINER_DEFINITION
166-
cpu: 3
166+
cpu: 6
167167
memory: 8G
168168
env:
169169
CIRRUS_CLONE_DEPTH: 10
@@ -178,8 +178,10 @@ plugin_qa_task:
178178
- source cirrus-env QA
179179
- source set_maven_build_version $BUILD_NUMBER
180180
- cd its/plugin
181-
- mvn verify -Dsonar.runtimeVersion=${SQ_VERSION} -Dmaven.test.redirectTestOutputToFile=false -B -e -V
181+
- mvn verify -Dsonar.runtimeVersion=${SQ_VERSION} -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Djunit.jupiter.execution.parallel.config.dynamic.factor=1
182182
cleanup_before_cache_script: cleanup_maven_repository
183+
cleanup_before_orchestrator_cache_script: bash .cirrus/clean-orchestrator-cache.sh
184+
183185

184186
ruling_task:
185187
depends_on:
@@ -225,6 +227,7 @@ pr_analysis_qa_task:
225227
- cd its/ruling
226228
- mvn verify -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dtest=PythonPrAnalysisTest
227229
cleanup_before_cache_script: cleanup_maven_repository
230+
cleanup_before_orchestrator_cache_script: bash .cirrus/clean-orchestrator-cache.sh
228231

229232
promote_task:
230233
depends_on:

.cirrus/clean-orchestrator-cache.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
cd "$ORCHESTRATOR_HOME" || exit 1
3+
4+
# Find all sonar-application-* JAR files, sort them by version, and list them
5+
files=$(find . -name "sonar-application-*" | sort --version-sort --field-separator=- --key=3 --reverse)
6+
7+
# Print the files that will be kept (the latest one)
8+
echo "Files that won't be deleted:"
9+
echo "$files" | head -n 1
10+
11+
# Get the files that will be deleted (all except the latest one)
12+
files_to_delete=$(echo "$files" | tail -n +2)
13+
14+
echo ""
15+
# Check if there are files to delete
16+
if [ -z "$files_to_delete" ]; then
17+
echo "No files will be deleted."
18+
else
19+
# Print the files that will be deleted
20+
echo "Files that will be deleted:"
21+
echo "$files_to_delete"
22+
23+
# Delete the files that will be deleted
24+
echo "$files_to_delete" | xargs -I {} sh -c 'rm -f "{}" && rmdir "$(dirname "{}")" 2>/dev/null || true'
25+
fi

0 commit comments

Comments
 (0)