Skip to content

Commit

Permalink
Merge pull request #436 from W0ngL1:dev_fingerprint_solr
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 688712757
Change-Id: I2ee9525e511a63346455a4557e303a6d485cb28d
  • Loading branch information
copybara-github committed Oct 22, 2024
2 parents b2532b9 + 2bb8a66 commit 91cbf07
Show file tree
Hide file tree
Showing 4 changed files with 26,889 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
solr:
image: solr:${SOLR_VERSION}
ports:
- "8983:8983"
command:
- solr-precreate
- gettingstarted
healthcheck:
test: curl --fail http://localhost:8983/ || exit 1
interval: 10s
timeout: 10s
retries: 3
start_period: 30s
97 changes: 97 additions & 0 deletions google/fingerprinters/web/scripts/updater/community/solr/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env bash

# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source ../../common.sh

SCRIPT_PATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
# Root path to the web fingerprinter plugin.
PROJECT_ROOT="$(cd -- "${SCRIPT_PATH}/../../../.." >/dev/null 2>&1 ; pwd -P)"
# Path to the configurations for starting a live instance of Solr.
APP_PATH="${SCRIPT_PATH}/app"
# Path to the temporary data holder.
TMP_DATA="/tmp/solr_fingerprints"
# Path to the local git repository for Solr codebase.
GIT_REPO="${TMP_DATA}/repo"
# Path to the directory of all the updated fingerprints data.
FINGERPRINTS_PATH="${TMP_DATA}/fingerprints"
# Json data of the final result.
JSON_DATA="${FINGERPRINTS_PATH}/fingerprint.json"
# Binary proto data of the final result.
BIN_DATA="${FINGERPRINTS_PATH}/fingerprint.binproto"
# Read all the versions to be fingerprinted.
readarray -t ALL_VERSIONS < "${SCRIPT_PATH}/versions.txt"
mkdir -p "${FINGERPRINTS_PATH}"

BINPROTO="${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/community/solr.binproto"
startSolr() {
local version="$1"
pushd "${APP_PATH}" >/dev/null
# add COMPOSE_HTTP_TIMEOUT to avoid docker-compose errors
SOLR_VERSION="${version}" COMPOSE_HTTP_TIMEOUT=200 docker compose up --wait -d
popd >/dev/null
}

stopSolr() {
local version="$1"
pushd "${APP_PATH}" >/dev/null
SOLR_VERSION="${version}" COMPOSE_HTTP_TIMEOUT=200 docker compose down --volumes --remove-orphans
popd >/dev/null
}

# Convert the existing data file to a human-readable json file.
convertFingerprint "${BINPROTO}" "${JSON_DATA}"

# Fetch Solr codebase.
if [[ ! -d "${GIT_REPO}" ]] ; then
git clone https://github.com/apache/solr.git "${GIT_REPO}"
fi

# Update for all the versions listed in versions.txt file.
for git_version in "${ALL_VERSIONS[@]}"; do
version=`echo ${git_version} | awk -F "/" '{print $3}'`
echo "Fingerprinting Solr version ${version} ..."
if [ "$version" == "8.1.0" ]; then
version="${version%.0}"
fi
if [ "$version" == "5.3.0" ]; then
version="${version%.0}"
fi
# Start a live instance of Solr.
echo "Waiting for Solr ${version} to be ready ..."
startSolr "${version}"
# No need to do other installation process for Solr.

# Checkout the repository to the correct tag.
checkOutRepo "${GIT_REPO}" "${git_version}"

updateFingerprint \
"solr" \
"${version}" \
"${FINGERPRINTS_PATH}" \
"${GIT_REPO}" \
"http://localhost:8983"

# Stop the live instance of Solr.
stopSolr "${version}"
done

convertFingerprint "${JSON_DATA}" "${BIN_DATA}"

echo "Fingerprint updated for Solr. Please commit the following file:"
echo " ${BIN_DATA}"

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
releases/lucene-solr/5.3.0
releases/lucene-solr/5.3.2
releases/lucene-solr/5.4.1
releases/lucene-solr/5.5.1
releases/lucene-solr/5.5.2
releases/lucene-solr/5.5.3
releases/lucene-solr/5.5.4
releases/lucene-solr/5.5.5
releases/lucene-solr/6.0.1
releases/lucene-solr/6.1.0
releases/lucene-solr/6.2.0
releases/lucene-solr/6.2.1
releases/lucene-solr/6.3.0
releases/lucene-solr/6.4.0
releases/lucene-solr/6.4.1
releases/lucene-solr/6.4.2
releases/lucene-solr/6.5.0
releases/lucene-solr/6.5.1
releases/lucene-solr/6.6.0
releases/lucene-solr/6.6.1
releases/lucene-solr/6.6.2
releases/lucene-solr/6.6.3
releases/lucene-solr/6.6.4
releases/lucene-solr/6.6.5
releases/lucene-solr/6.6.6
releases/lucene-solr/7.0.0
releases/lucene-solr/7.0.1
releases/lucene-solr/7.1.0
releases/lucene-solr/7.2.0
releases/lucene-solr/7.2.1
releases/lucene-solr/7.3.0
releases/lucene-solr/7.3.1
releases/lucene-solr/7.4.0
releases/lucene-solr/7.5.0
releases/lucene-solr/7.6.0
releases/lucene-solr/7.7.0
releases/lucene-solr/7.7.1
releases/lucene-solr/7.7.2
releases/lucene-solr/7.7.3
releases/lucene-solr/8.0.0
releases/lucene-solr/8.1.0
releases/lucene-solr/8.1.1
releases/lucene-solr/8.2.0
releases/lucene-solr/8.3.0
releases/lucene-solr/8.3.1
releases/lucene-solr/8.4.0
releases/lucene-solr/8.4.1
releases/lucene-solr/8.5.0
releases/lucene-solr/8.5.1
releases/lucene-solr/8.5.2
releases/lucene-solr/8.6.0
releases/lucene-solr/8.6.1
releases/lucene-solr/8.6.2
releases/lucene-solr/8.6.3
releases/lucene-solr/8.7.0
releases/lucene-solr/8.8.0
releases/lucene-solr/8.8.1
releases/solr/9.0.0
releases/solr/9.1.0
releases/solr/9.1.1
releases/solr/9.2.0
releases/solr/9.2.1
releases/solr/9.3.0
releases/solr/9.4.0
releases/solr/9.4.1
releases/solr/9.5.0
releases/solr/9.6.0
releases/solr/9.6.1
releases/solr/9.7.0
Loading

0 comments on commit 91cbf07

Please sign in to comment.