Skip to content

Commit 8b9d63c

Browse files
authored
Refactor ElasticSearch version detection logic
Signed-off-by: enoch85 <[email protected]>
1 parent d4536dd commit 8b9d63c

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,17 @@ fulltextsearch_install() {
200200
ELASTIC_USER_PASSWORD=$(gen_passwd "$SHUF" '[:lower:]')
201201
FULLTEXTSEARCH_IMAGE_NAME=fulltextsearch_es01
202202
FULLTEXTSEARCH_SERVICE=nextcloud-fulltext-elasticsearch-worker.service
203-
204203
# Gets the version from the latest tag here: https://github.com/docker-library/official-images/blob/master/library/elasticsearch
205204
# Use limit=500 to ensure we get version tags, not just SHA tags
206205
# Extract version numbers (format: X.XX.X), sort them, and get the latest
207206
FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG="$(curl -s -m 900 'https://raw.githubusercontent.com/docker-library/official-images/refs/heads/master/library/elasticsearch' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -1)"
208-
209207
# Validate that we got a proper version number
210208
if ! echo "$FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'
211209
then
212210
print_text_in_color "$IRed" "Failed to detect ElasticSearch version. Got: '$FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG'"
213211
print_text_in_color "$ICyan" "Falling back to known stable version..."
214212
FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG="8.16.1"
215-
fi
216-
217-
print_text_in_color "$ICyan" "ElasticSearch version detected: $FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG"
218-
213+
fi
219214
# Legacy, changed 2023-09-21
220215
DOCKER_IMAGE_NAME=es01
221216
# Legacy, not used at all

0 commit comments

Comments
 (0)