From 264e2251185e1876d4bbdc0e155625f7011623ac Mon Sep 17 00:00:00 2001 From: W0ngL1 <148697527+W0ngL1@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:40:42 +0800 Subject: [PATCH 1/7] feat: update version.txt for grafana fingerprinter --- .../updater/community/grafana/versions.txt | 348 ++++++++++++++++++ 1 file changed, 348 insertions(+) create mode 100644 google/fingerprinters/web/scripts/updater/community/grafana/versions.txt diff --git a/google/fingerprinters/web/scripts/updater/community/grafana/versions.txt b/google/fingerprinters/web/scripts/updater/community/grafana/versions.txt new file mode 100644 index 000000000..e6233b2f3 --- /dev/null +++ b/google/fingerprinters/web/scripts/updater/community/grafana/versions.txt @@ -0,0 +1,348 @@ +v11.3.0 +v11.2.3 +v11.1.8 +v11.0.7 +v10.4.11 +v10.3.12 +v11.2.2 +v11.1.7 +v11.0.6 +v10.4.10 +v10.3.11 +v11.2.1 +v11.1.6 +v11.0.5 +v10.4.9 +v10.3.10 +v11.2.0 +v11.1.5 +v11.0.4 +v10.4.8 +v10.3.9 +v11.1.4 +v11.0.3 +v10.4.7 +v11.1.1 +v11.1.2 +v9.5.21 +v10.2.9 +v10.4.6 +v11.0.2 +v11.1.3 +v10.0.0 +v9.5.20 +v10.2.8 +v10.3.7 +v10.4.5 +v11.0.1 +v11.1.0 +v10.4.4 +v11.0.0 +v10.1.10 +v9.5.19 +v10.2.7 +v10.3.6 +v10.4.3 +v10.4.2 +v10.1.9 +v10.2.6 +v9.5.18 +v10.0.13 +v10.3.5 +v10.4.1 +v10.0.12 +v10.3.4 +v10.2.5 +v10.1.8 +v9.5.17 +v10.4.0 +v10.2.4 +v10.1.7 +v10.3.3 +v10.0.11 +v9.5.16 +v10.3.1 +v10.3.0 +v9.5.15 +v10.0.10 +v10.1.6 +v10.2.3 +v10.2.2 +v9.5.14 +v10.2.1 +v10.2.0 +v10.1.5 +v10.0.9 +v9.5.13 +v9.4.17 +v9.5.12 +v10.0.8 +v10.1.4 +v10.1.2 +v10.0.6 +v9.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0.1 +v4.0.0 +v3.1.0 +v2.6.0 +v2.0.2 +v2.1.1 +v2.1.0 +v2.0.1 +v2.5.0 +v2.1.3 From 9e168f16b13e708622fe2a12cb547ef4427e08e2 Mon Sep 17 00:00:00 2001 From: W0ngL1 <148697527+W0ngL1@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:50:28 +0800 Subject: [PATCH 2/7] feat: first update.sh for grafana fingerprinter --- .../updater/community/grafana/update.sh | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 google/fingerprinters/web/scripts/updater/community/grafana/update.sh diff --git a/google/fingerprinters/web/scripts/updater/community/grafana/update.sh b/google/fingerprinters/web/scripts/updater/community/grafana/update.sh new file mode 100644 index 000000000..d54537e00 --- /dev/null +++ b/google/fingerprinters/web/scripts/updater/community/grafana/update.sh @@ -0,0 +1,91 @@ +#!/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 Grafana. +APP_PATH="${SCRIPT_PATH}/app" +# Path to the temporary data holder. +TMP_DATA="/tmp/granfa_fingerprints" +# Path to the local git repository for Grafana 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/granfa.binproto" +startGrafana() { + local version="$1" + pushd "${APP_PATH}" >/dev/null + # add COMPOSE_HTTP_TIMEOUT to avoid docker-compose errors + GRAFANA_VERSION="${version}" COMPOSE_HTTP_TIMEOUT=200 docker compose up --wait -d + popd >/dev/null +} + +stopGrafana() { + local version="$1" + pushd "${APP_PATH}" >/dev/null + GRAFANA_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 Grafana codebase. +if [[ ! -d "${GIT_REPO}" ]] ; then + git clone https://github.com/granfa/granfa.git "${GIT_REPO}" +fi + +# Update for all the versions listed in versions.txt file. +for git_version in "${ALL_VERSIONS[@]}"; do + version=${git_version#v} + echo "Fingerprinting Grafana version ${version} ..." + + # Start a live instance of Grafana. + echo "Waiting for Grafana ${version} to be ready ..." + startGrafana "${version}" + # No need to do other installation process for Grafana. + + # Checkout the repository to the correct tag. + checkOutRepo "${GIT_REPO}" "${git_version}" + + updateFingerprint \ + "granfa" \ + "${version}" \ + "${FINGERPRINTS_PATH}" \ + "${GIT_REPO}" \ + "http://localhost:3000" + + # Stop the live instance of Grafana. + stopGrafana "${version}" +done + +convertFingerprint "${JSON_DATA}" "${BIN_DATA}" + +echo "Fingerprint updated for Grafana. Please commit the following file:" +echo " ${BIN_DATA}" From 8ed61fc2191693d05a08b3916a5686927a740cf1 Mon Sep 17 00:00:00 2001 From: W0ngL1 <148697527+W0ngL1@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:28:14 +0800 Subject: [PATCH 3/7] feat: update docker-compose.yaml --- .../updater/community/grafana/app/docker-compose.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 google/fingerprinters/web/scripts/updater/community/grafana/app/docker-compose.yaml diff --git a/google/fingerprinters/web/scripts/updater/community/grafana/app/docker-compose.yaml b/google/fingerprinters/web/scripts/updater/community/grafana/app/docker-compose.yaml new file mode 100644 index 000000000..646fe3f81 --- /dev/null +++ b/google/fingerprinters/web/scripts/updater/community/grafana/app/docker-compose.yaml @@ -0,0 +1,11 @@ +services: + grafana: + image: "grafana/grafana:${GRAFANA_VERSION}" + container_name: grafana + restart: unless-stopped + ports: + - '3000:3000' + volumes: + - grafana-storage:/var/lib/grafana +volumes: + grafana-storage: {} From dc1a6413d9b8891bba4b0eeb9df5dded2baea35f Mon Sep 17 00:00:00 2001 From: W0ngL1 <148697527+W0ngL1@users.noreply.github.com> Date: Tue, 29 Oct 2024 21:27:06 +0800 Subject: [PATCH 4/7] chore: change mode --- .../web/scripts/updater/community/grafana/update.sh | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 google/fingerprinters/web/scripts/updater/community/grafana/update.sh diff --git a/google/fingerprinters/web/scripts/updater/community/grafana/update.sh b/google/fingerprinters/web/scripts/updater/community/grafana/update.sh old mode 100644 new mode 100755 index d54537e00..b2a5dcd48 --- a/google/fingerprinters/web/scripts/updater/community/grafana/update.sh +++ b/google/fingerprinters/web/scripts/updater/community/grafana/update.sh @@ -89,3 +89,4 @@ convertFingerprint "${JSON_DATA}" "${BIN_DATA}" echo "Fingerprint updated for Grafana. Please commit the following file:" echo " ${BIN_DATA}" + From 00ca947e2e0c805ce85cb370ada8cf48802b8641 Mon Sep 17 00:00:00 2001 From: W0ngL1 <148697527+W0ngL1@users.noreply.github.com> Date: Sun, 3 Nov 2024 21:15:03 +0800 Subject: [PATCH 5/7] chore: update software name --- .../web/scripts/updater/community/grafana/update.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/google/fingerprinters/web/scripts/updater/community/grafana/update.sh b/google/fingerprinters/web/scripts/updater/community/grafana/update.sh index b2a5dcd48..fb35b8627 100755 --- a/google/fingerprinters/web/scripts/updater/community/grafana/update.sh +++ b/google/fingerprinters/web/scripts/updater/community/grafana/update.sh @@ -24,7 +24,7 @@ PROJECT_ROOT="$(cd -- "${SCRIPT_PATH}/../../../.." >/dev/null 2>&1 ; pwd -P)" # Path to the configurations for starting a live instance of Grafana. APP_PATH="${SCRIPT_PATH}/app" # Path to the temporary data holder. -TMP_DATA="/tmp/granfa_fingerprints" +TMP_DATA="/tmp/grafana_fingerprints" # Path to the local git repository for Grafana codebase. GIT_REPO="${TMP_DATA}/repo" # Path to the directory of all the updated fingerprints data. @@ -37,7 +37,7 @@ BIN_DATA="${FINGERPRINTS_PATH}/fingerprint.binproto" readarray -t ALL_VERSIONS < "${SCRIPT_PATH}/versions.txt" mkdir -p "${FINGERPRINTS_PATH}" -BINPROTO="${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/community/granfa.binproto" +BINPROTO="${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/community/grafana.binproto" startGrafana() { local version="$1" pushd "${APP_PATH}" >/dev/null @@ -58,7 +58,7 @@ convertFingerprint "${BINPROTO}" "${JSON_DATA}" # Fetch Grafana codebase. if [[ ! -d "${GIT_REPO}" ]] ; then - git clone https://github.com/granfa/granfa.git "${GIT_REPO}" + git clone https://github.com/grafana/grafana.git "${GIT_REPO}" fi # Update for all the versions listed in versions.txt file. @@ -75,7 +75,7 @@ for git_version in "${ALL_VERSIONS[@]}"; do checkOutRepo "${GIT_REPO}" "${git_version}" updateFingerprint \ - "granfa" \ + "grafana" \ "${version}" \ "${FINGERPRINTS_PATH}" \ "${GIT_REPO}" \ From abb14a8d3e8861cfe4b6e338ec71a192eaee0a7c Mon Sep 17 00:00:00 2001 From: W0ngL1 <148697527+W0ngL1@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:34:14 +0800 Subject: [PATCH 6/7] chore: set git lfs for uploading big files --- .../resources/fingerprinters/web/data/community/.gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 google/fingerprinters/web/src/main/resources/fingerprinters/web/data/community/.gitattributes diff --git a/google/fingerprinters/web/src/main/resources/fingerprinters/web/data/community/.gitattributes b/google/fingerprinters/web/src/main/resources/fingerprinters/web/data/community/.gitattributes new file mode 100644 index 000000000..21e5328f6 --- /dev/null +++ b/google/fingerprinters/web/src/main/resources/fingerprinters/web/data/community/.gitattributes @@ -0,0 +1 @@ +grafana.binproto filter=lfs diff=lfs merge=lfs -text From b0f6cb423759f7975670d0c8264f2c43a53521a5 Mon Sep 17 00:00:00 2001 From: W0ngL1 <148697527+W0ngL1@users.noreply.github.com> Date: Thu, 21 Nov 2024 21:32:15 +0800 Subject: [PATCH 7/7] chore: remove lfs attribute --- .../resources/fingerprinters/web/data/community/.gitattributes | 1 - 1 file changed, 1 deletion(-) diff --git a/google/fingerprinters/web/src/main/resources/fingerprinters/web/data/community/.gitattributes b/google/fingerprinters/web/src/main/resources/fingerprinters/web/data/community/.gitattributes index 21e5328f6..e69de29bb 100644 --- a/google/fingerprinters/web/src/main/resources/fingerprinters/web/data/community/.gitattributes +++ b/google/fingerprinters/web/src/main/resources/fingerprinters/web/data/community/.gitattributes @@ -1 +0,0 @@ -grafana.binproto filter=lfs diff=lfs merge=lfs -text