Skip to content
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
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ repos:
entry: make
args: ['lint']
pass_filenames: false
- id: shellcheck
name: shellcheck
language: system
entry: shellcheck
types: [shell]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.13
hooks:
- id: ruff
- id: ruff-format
2 changes: 2 additions & 0 deletions hack/pullspecs_replaceatron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ for var_name in $RELATED_IMAGE_VARS; do

if [[ -n "$current_csv_value" ]]; then
# Escape special characters for sed
# shellcheck disable=SC2016
escaped_current=$(printf '%s\n' "$current_csv_value" | sed 's/[[\.*^$()+?{|]/\\&/g')
# shellcheck disable=SC2016
escaped_new=$(printf '%s\n' "$current_value" | sed 's/[[\.*^$()+?{|]/\\&/g')

# Replace all occurrences of the current value with the new value
Expand Down
10 changes: 5 additions & 5 deletions internal/controller/assets/postgres_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ _psql () { psql --set ON_ERROR_STOP=1 "$@" ; }
# Create database for llama-stack conversation storage
DB_NAME="llamastack"

echo "SELECT 'CREATE DATABASE $DB_NAME' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$DB_NAME')\gexec" | _psql -d $POSTGRESQL_DATABASE
echo "SELECT 'CREATE DATABASE $DB_NAME' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$DB_NAME')\gexec" | _psql -d "$POSTGRESQL_DATABASE"

# Create pg_trgm extension in default database (for OpenStack Lightspeed conversation cache)
echo "CREATE EXTENSION IF NOT EXISTS pg_trgm;" | _psql -d $POSTGRESQL_DATABASE
echo "CREATE EXTENSION IF NOT EXISTS pg_trgm;" | _psql -d "$POSTGRESQL_DATABASE"

# Create pg_trgm extension in llama-stack database (for text search if needed)
echo "CREATE EXTENSION IF NOT EXISTS pg_trgm;" | _psql -d $DB_NAME

# Create schemas for isolating different components' data
echo "CREATE SCHEMA IF NOT EXISTS lcore;" | _psql -d $POSTGRESQL_DATABASE
echo "CREATE SCHEMA IF NOT EXISTS quota;" | _psql -d $POSTGRESQL_DATABASE
echo "CREATE SCHEMA IF NOT EXISTS conversation_cache;" | _psql -d $POSTGRESQL_DATABASE
echo "CREATE SCHEMA IF NOT EXISTS lcore;" | _psql -d "$POSTGRESQL_DATABASE"
echo "CREATE SCHEMA IF NOT EXISTS quota;" | _psql -d "$POSTGRESQL_DATABASE"
echo "CREATE SCHEMA IF NOT EXISTS conversation_cache;" | _psql -d "$POSTGRESQL_DATABASE"
10 changes: 5 additions & 5 deletions internal/controller/assets/vector_database_collect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# --enable-ocp-rag BOOL Enable OCP vector DB collection: true/false (required)
# --ocp-version VERSION OCP version to collect, e.g., "X.YZ" (required)

set -euo pipefail
set -eu
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It would have been good to mention in the commit that the pipefail option was pointless here, since there are no pipes being used. Otherwise we wouldn't have been able to just remote the option.


# -- vector_database_collect.sh script parameters ----------------------------

Expand Down Expand Up @@ -173,7 +173,7 @@ parse_arguments_and_init() {
}

validate_vector_db_dir() {
local vector_db_dir="$1"
vector_db_dir="$1"

if [ ! -d "${vector_db_dir}" ]; then
echo "ERROR: ${vector_db_dir} is not a directory"
Expand All @@ -200,7 +200,7 @@ collect_ocp_vector_db_data() {
echo "Collecting OCP vector DB data ..."
mkdir -p "${VECTOR_DB_DATA_COLLECT_DIR}"

local ocp_dir="${OCP_VECTOR_DB_DIR}/ocp_${OCP_VERSION}"
ocp_dir="${OCP_VECTOR_DB_DIR}/ocp_${OCP_VERSION}"
if [ ! -d "${ocp_dir}" ]; then
echo "Data for OCP version ${OCP_VERSION} not found. Using: ${OCP_VECTOR_DB_DIR_FALLBACK}"
ocp_dir=${OCP_VECTOR_DB_DIR_FALLBACK}
Expand All @@ -214,8 +214,8 @@ collect_ocp_vector_db_data() {
collect_vector_db_data() {
echo "Collecting vector DB data ..."
mkdir -p "${VECTOR_DB_DATA_COLLECT_DIR}"
local vector_db_data_collected="false"
for dir in ${VECTOR_DB_DIR}/*/; do
vector_db_data_collected="false"
for dir in "${VECTOR_DB_DIR}"/*/; do
[ ! -d "$dir" ] && continue

validate_vector_db_dir "$dir"
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen-rhosls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
- openstack-lightspeed
EOF

for i in $(seq 1 20); do
for _i in $(seq 1 20); do
CSV_VERSION=$(oc get --ignore-not-found=true packagemanifest openstack-lightspeed-operator -o go-template="{{range .status.channels}}{{if eq .name \"${CHANNEL}\"}}{{.currentCSV}}{{\"\n\"}}{{end}}{{end}}")
if [ -n "${CSV_VERSION}" ]; then
break
Expand Down
2 changes: 1 addition & 1 deletion test/kuttl/common/expected-configs/validate-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mkdir -p "$KUTTL_TEMP_DIR"
cleanup() {
if [ -d "$KUTTL_TEMP_DIR" ]; then
echo "Cleaning up temporary files..."
rm -f "$KUTTL_TEMP_DIR"/actual-${CONFIG_TYPE}-*.yaml 2>/dev/null || true
rm -f "$KUTTL_TEMP_DIR"/actual-"${CONFIG_TYPE}"-*.yaml 2>/dev/null || true
fi
}
trap cleanup EXIT INT TERM
Expand Down
Loading