Refuse deploy early when Pillar can't be found or isn't on production

Without this, it will only block the deploy mid-way when we try to
rsync_ui. Now it just stops early before doing anything server-side.
This commit is contained in:
2016-08-26 14:33:22 +02:00
parent c388a62b1b
commit 4267f313ab

View File

@@ -22,6 +22,24 @@ if [ -n "$(git log origin/production..production --oneline)" ]; then
read dummy read dummy
fi fi
# Find Pillar
PILLAR_DIR=$(python <<EOT
from __future__ import print_function
import os.path
try:
import pillar
except ImportError:
raise SystemExit('Pillar not found on Python path. Are you in the correct venv?')
print(os.path.dirname(os.path.dirname(pillar.__file__)))
EOT
)
if [ $(git -C $PILLAR_DIR rev-parse --abbrev-ref HEAD) != "production" ]; then
echo "Pillar ($PILLAR_DIR) NOT on the production branch, refusing to deploy." >&2
exit 1
fi
# SSH to cloud to pull all files in # SSH to cloud to pull all files in
function git_pull() { function git_pull() {
PROJECT_NAME="$1" PROJECT_NAME="$1"