-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONARPY-2471: Orchestrator cache should be cleaned up when using the …
…DEV version (#2254)
- Loading branch information
Showing
2 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
cd "$ORCHESTRATOR_HOME" || exit 1 | ||
|
||
# Find all sonar-application-* JAR files, sort them by version, and list them | ||
files=$(find . -name "sonar-application-*" | sort --version-sort --field-separator=- --key=3 --reverse) | ||
|
||
# Print the files that will be kept (the latest one) | ||
echo "Files that won't be deleted:" | ||
echo "$files" | head -n 1 | ||
|
||
# Get the files that will be deleted (all except the latest one) | ||
files_to_delete=$(echo "$files" | tail -n +2) | ||
|
||
echo "" | ||
# Check if there are files to delete | ||
if [ -z "$files_to_delete" ]; then | ||
echo "No files will be deleted." | ||
else | ||
# Print the files that will be deleted | ||
echo "Files that will be deleted:" | ||
echo "$files_to_delete" | ||
|
||
# Delete the files that will be deleted | ||
echo "$files_to_delete" | xargs -I {} sh -c 'rm -f "{}" && rmdir "$(dirname "{}")" 2>/dev/null || true' | ||
fi |