mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Updated tinybird unsafe deploy script (#21135)
ref https://github.com/TryGhost/Ghost/pull/21092 - This updates the unsafe deploy script to be safer and more useful
This commit is contained in:
parent
21ecd9c2af
commit
908ff731d6
1 changed files with 26 additions and 1 deletions
27
ghost/tinybird/scripts/unsafe_redeploy.sh
Normal file → Executable file
27
ghost/tinybird/scripts/unsafe_redeploy.sh
Normal file → Executable file
|
@ -1,3 +1,28 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Check if --force flag is provided
|
||||||
|
force=false
|
||||||
|
if [[ "$@" == *"--force"* ]]; then
|
||||||
|
force=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get current branch info
|
||||||
|
branch_info=$(tb branch current)
|
||||||
|
|
||||||
|
# Check if 'main' and 'production_stats' are both present in the output
|
||||||
|
if echo "$branch_info" | grep -q "main" && echo "$branch_info" | grep -q "production_stats"; then
|
||||||
|
if [ "$force" = false ]; then
|
||||||
|
echo "🚨 ERROR: Attempting to run unsafe_redeploy on main branch in production_stats workspace."
|
||||||
|
echo "If you're sure you want to do this, run the script with the --force flag."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "⚠️ WARNING: Running unsafe_redeploy on main branch in production_stats workspace with --force flag."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Proceeding with unsafe redeploy..."
|
||||||
|
|
||||||
# Remove our materialized views and their pipes
|
# Remove our materialized views and their pipes
|
||||||
tb datasource rm analytics_pages_mv --yes
|
tb datasource rm analytics_pages_mv --yes
|
||||||
tb datasource rm analytics_sessions_mv --yes
|
tb datasource rm analytics_sessions_mv --yes
|
||||||
|
@ -17,4 +42,4 @@ tb pipe rm pipes/top_sources.pipe --yes
|
||||||
tb pipe rm pipes/trend.pipe --yes
|
tb pipe rm pipes/trend.pipe --yes
|
||||||
|
|
||||||
# Push all the changes
|
# Push all the changes
|
||||||
tb push --only-changes --force --populate
|
tb push --force --populate
|
||||||
|
|
Loading…
Add table
Reference in a new issue