Skip to content

Commit 46b7ff0

Browse files
committed
Update deploy_fly.sh
1 parent 68c95db commit 46b7ff0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

scripts/deployment/deploy_fly.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ if [[ -n "$TEMP_ENV_FILE" && -f "$TEMP_ENV_FILE" ]]; then
213213
echo "🧹 Cleaned up temporary configuration file"
214214
fi
215215

216+
# Always ensure ANOMSTACK_BUILD_HASH is set correctly
217+
if [[ -n "$GIT_COMMIT_HASH" ]]; then
218+
all_secrets+=("ANOMSTACK_BUILD_HASH=$GIT_COMMIT_HASH")
219+
echo "🏷️ Adding build hash to secrets: $GIT_COMMIT_HASH"
220+
fi
221+
216222
# Set all secrets in one command to minimize releases
217223
if [[ ${#all_secrets[@]} -gt 0 ]]; then
218224
echo "🔐 Setting ${#all_secrets[@]} environment variables as Fly secrets in single operation..."
@@ -249,8 +255,8 @@ if [[ "$FORCE_REBUILD" == "true" ]]; then
249255
echo "🔄 Force rebuild enabled - using aggressive cache busting..."
250256
echo "🎯 Cache bust value: $CACHEBUST_VALUE"
251257

252-
# Use multiple cache busting strategies:
253-
# 1. --no-cache: Skip Docker layer cache
258+
# Force rebuild with multiple strategies:
259+
# 1. --no-cache: Skip Docker layer cache entirely
254260
# 2. CACHEBUST build arg: Force rebuild of layers that use it
255261
# 3. ANOMSTACK_BUILD_HASH build arg: Include git commit hash in container
256262
# 4. --dockerfile: Explicit dockerfile path to avoid confusion
@@ -260,6 +266,10 @@ if [[ "$FORCE_REBUILD" == "true" ]]; then
260266
--build-arg ANOMSTACK_BUILD_HASH="$GIT_COMMIT_HASH" \
261267
--dockerfile docker/Dockerfile.fly \
262268
-a "$APP_NAME"
269+
270+
# After deployment, manually update the secret to ensure consistency
271+
echo "🔄 Updating ANOMSTACK_BUILD_HASH secret to match deployed version..."
272+
fly secrets set ANOMSTACK_BUILD_HASH="$GIT_COMMIT_HASH" -a "$APP_NAME"
263273
else
264274
echo "⚡ Standard deployment (with caching)..."
265275
fly deploy \

0 commit comments

Comments
 (0)