if you look in the artifacts uploaded, you'll see local doesn't use container - it runs native OS, also see how other run.sh actions and how docker compose is run: ./run.sh dev config ๐ Starting SAAS Management Wrapper [./run.sh] --> (dev)... --------------------------------- โป๏ธ [./generate-env.sh] Generating .env file for dsass form (.env-dev)... --------------------------------- ๐๏ธ Today is:2026_06_26 11310 ๐ Fetching all secrets for dsass (dev)... โ ๏ธ Vault Secrets saved to .env fie. -> ๐งน (remember to delete .env file when done) ๐ง .env-global merged into .env file ๐ง .env-dev merged into .env file ๐ก๏ธ APP_VERSION:v3.0.4 derived from git tags... --------------------------------- โ
.env file BUILT for dsass (dev)! --------------------------------- .env: line 84: dev-bind: command not found ๐ Compose Project Name: dsass ๐งน Cleaning old compressed assets... ๐ฆ Compressing static assets... docker compose -f docker-compose.yml -f docker-compose-dev.yml config Tell you what - instead of trying to figure it out, just combine into single script call validate-schema.sh Input arg ENV_TYPE=${1:-$FLASK_ENV} Error of not local,dev,qa,prod then run ./generate-env.sh $ENV_TYPE then grep COMPOSE_PROJECT_NAME .env grep COMPOSE_PROJECT_NAME .env COMPOSE_PROJECT_NAME=dsass CONTAINER=$(docker compose ps | grep ${COMPOSE_PROJECT_NAME}-web-1|awk '{print $1}') docker compose ps|grep dsass-web-1|awk '{print $1}' dsass-web-1 DB_CHECK=$(docker compose exec -T $CONTAINER flask db check) get the idea... also: remove silent and always give status of what happening consistent with other scripts If migration is detected, prompt user to migrate with timeout if no response continue so git workflow can continue reasonably
#!/usr/bin/env bash
# =================================================================================
# ๐ก๏ธ SCHEMA VALIDATION ENGINE
# =================================================================================
# Validates database state against application models to detect schema drift.
# Adheres to zero-downtime, immutable environment promotion constraints.
# All notifications use exact two-space formatting prefix.
# =================================================================================
set -e
ENV_TYPE=${1:-$FLASK_ENV}
if [[ ! "${ENV_TYPE}" =~ ^(local|dev|qa|prod)$ ]]; then
echo " [ERROR] Invalid target environment: '${ENV_TYPE}'"
echo " [ERROR] Usage: ./validate-schema.sh [local|dev|qa|prod]"
exit 1
fi
echo " ๐ Starting SAAS Schema Validation Suite [${ENV_TYPE}]..."
echo " โป๏ธ Executing environment variable configuration assembly..."
if [ -f "./generate-env.sh" ]; then
./generate-env.sh "${ENV_TYPE}"
else
echo " [ERROR] Engine dependency missing: ./generate-env.sh not found."
exit 1
fi
if [ ! -f ".env" ]; then
echo " [ERROR] Runtime assembly failed: .env file was not generated."
exit 1
fi
COMPOSE_PROJECT_NAME=$(grep '^COMPOSE_PROJECT_NAME=' .env | cut -d'=' -f2 || true)
if [ -z "${COMPOSE_PROJECT_NAME}" ]; then
echo " [ERROR] System parameter configuration missing: COMPOSE_PROJECT_NAME not found in .env"
exit 1
fi
echo " ๐ Compose Project Name: ${COMPOSE_PROJECT_NAME}"
DB_STATUS=0
if [ "${ENV_TYPE}" = "local" ]; then
echo " ๐ป Detected native host execution topology for environment: [local]"
echo " [EXEC] Exporting unified runtime parameters to native shell state..."
set -a
source .env
set +a
echo " [EXEC] Querying local Alembic engine context for schema drift..."
set +e
flask db check > /dev/null 2>&1
DB_STATUS=$?
set -e
else
echo " ๐ฆ Detected containerized ecosystem orchestration for environment: [${ENV_TYPE}]"
echo " [EXEC] Resolving active service identifier targeting: ${COMPOSE_PROJECT_NAME}-web-1"
CONTAINER=$(docker compose ps | grep "${COMPOSE_PROJECT_NAME}-web-1" | awk '{print $1}' | head -n 1)
if [ -z "${CONTAINER}" ]; then
echo " [ERROR] Execution context unavailable: Container ${COMPOSE_PROJECT_NAME}-web-1 is offline."
echo " [ERROR] Please verify application stack health before initializing validation routines."
exit 1
fi
echo " ๐ Target Container Found: ${CONTAINER}"
echo " [EXEC] Querying containerized Alembic engine context for schema drift..."
set +e
docker compose exec -T "${CONTAINER}" flask db check > /dev/null 2>&1
DB_STATUS=$?
set -e
fi
if [ ${DB_STATUS} -eq 0 ]; then
echo " [SUCCESS] Database schema state matches application models perfectly."
exit 0
else
echo " [WARNING] SCHEMA DRIFT DETECTED! Local code definitions have diverged from the database layout."
if [[ "${ENV_TYPE}" =~ ^(qa|prod)$ ]]; then
echo " [ERROR] Protected environment boundary violation: Modification prevented on [${ENV_TYPE}]."
echo " [ERROR] Deployment halted. Schemas must be generated locally or in dev and committed via version files."
exit 1
fi
echo " [PROMPT] Would you like to execute an automatic migration generation sequence? (y/N) [10s Timeout]"
set +e
read -t 10 -p " Selection: " USER_CHOICE
READ_STATUS=$?
set -e
if [ ${READ_STATUS} -gt 128 ]; then
echo ""
echo " [TIMEOUT] Interaction threshold exceeded. Continuing git/CI pipeline workflow execution without migrating..."
exit 0
fi
if [[ "${USER_CHOICE}" =~ ^[Yy]$ ]]; then
read -p " Enter formal migration description message: " MIGRATION_MSG
if [ -z "${MIGRATION_MSG}" ]; then
MIGRATION_MSG="auto_migration_$(date +%Y%m%d%H%M%S)"
fi
echo " [EXEC] Compiling schema changes into native migration script..."
if [ "${ENV_TYPE}" = "local" ]; then
flask db migrate -m "${MIGRATION_MSG}"
else
docker compose exec -T "${CONTAINER}" flask db migrate -m "${MIGRATION_MSG}"
fi
echo " [SUCCESS] Migration version script successfully generated and written to local disk repository."
else
echo " [SKIP] Skipping migration generation sequence via user choice. Continuing git workflow tracking..."
fi
fi
Post navigation