Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fingerprint, Updater script for flyte console. #471

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
flyte-console:
image: ghcr.io/flyteorg/flyteconsole-release:${FLYTE_CONSOLE_VERSION}
ports:
- 8080:8080
environment:
BASE_URL: "/console"
CONFIG_DIR: "/etc/flyte/config"
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env bash

# Copyright 2022 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 Flyte.
FLYTE_APP_PATH="${SCRIPT_PATH}/app"
# Path to the temporary data holder.
TMP_DATA="/tmp/FLYTE_fingerprints"
# Path to the local git repository for Flyte 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}"

startFlyteConsole() {
local version="$1"
pushd "${FLYTE_APP_PATH}" >/dev/null
FLYTE_CONSOLE_VERSION="${version}" docker compose up -d
popd >/dev/null
}

stopFlyteConsole() {
local version="$1"
pushd "${FLYTE_APP_PATH}" >/dev/null
FLYTE_CONSOLE_VERSION="${version}" docker compose down --volumes --remove-orphans
popd >/dev/null
}

createFingerprintForDashboard() {
local FLYTE_CONSOLE_VERSION="$1"

echo "Fingerprinting Flyte version ${FLYTE_CONSOLE_VERSION} ..."
# Start a live instance of Flyte.
startFlyteConsole "${FLYTE_CONSOLE_VERSION}"
# Arbitrarily chosen so that FlyteFlyte is up and running.
echo "Waiting for Flyte ${FLYTE_CONSOLE_VERSION} to be ready ..."
sleep 10

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

updateFingerprint \
"flyte" \
"${FLYTE_CONSOLE_VERSION}" \
"${FINGERPRINTS_PATH}" \
"${GIT_REPO}/website/console" \
"http://localhost:8080/console/"

# Stop the live instance of Flyte.
stopFlyteConsole "${FLYTE_CONSOLE_VERSION}"
}


# Convert the existing data file to a human-readable json file.
convertFingerprint \
"${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/community/flyte.binproto" \
"${JSON_DATA}"

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

# Update for all the versions listed in versions.txt file.
for FLYTE_CONSOLE_VERSION in "${ALL_VERSIONS[@]}"; do
createFingerprintForDashboard "${FLYTE_CONSOLE_VERSION}"
done

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

echo "Fingerprint updated for Flyte. Please commit the following file:"
echo " ${BIN_DATA}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
v1.12.0
v1.11.0
v1.10.0
v1.9.1
v1.9.0
v1.8.1
v1.8.0
v1.7.0
v1.6.2
v1.6.1
v1.6.0
v1.5.1
v1.5.0
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.0
v1.2.1
v1.2.0
v1.1.6
v1.1.3
v1.1.0
v1.1.1
v1.0.0
v0.19.4
Loading
Loading