Skip to content

Commit c8a9266

Browse files
committed
dev changes for deployment
1 parent 2831efc commit c8a9266

File tree

8 files changed

+201
-679
lines changed

8 files changed

+201
-679
lines changed

.github/workflows/snowpark-ci-cd.yml

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,26 +260,64 @@ jobs:
260260
echo "ENVIRONMENT: $ENVIRONMENT"
261261
echo "DATABASE_NAME: $DATABASE_NAME"
262262
263+
# Configure git for better change detection
264+
git config --global core.quotepath off
265+
git fetch --prune --unshallow
266+
263267
deploy_component() {
264268
local component_path=$1
265269
local component_name=$2
266270
local component_type=$3
267271
268-
# Check if component files have changed since last deployment
269-
echo "Checking for changes in $component_path..."
272+
echo "🔍 Checking for changes in $component_path..."
273+
274+
# Default to not deploying
275+
should_deploy=false
270276
271-
# Get the last commit hash where this component was changed
272-
local last_change=$(git log -n 1 --format=format:%H --full-diff -- "$component_path")
277+
# For pull requests, always deploy components
278+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
279+
echo "Pull request detected - always deploying component"
280+
should_deploy=true
281+
# For workflow_dispatch, always deploy components
282+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
283+
echo "Manual workflow dispatch detected - always deploying component"
284+
should_deploy=true
285+
else
286+
# Check for force_deploy file
287+
if [[ -f "$component_path/.force_deploy" ]]; then
288+
echo "🔥 Force deploy file found - forcing deployment"
289+
should_deploy=true
290+
else
291+
# For push events, check if component changed in this commit
292+
# Get changed files in the most recent commit
293+
changed_files=$(git diff --name-only HEAD HEAD~1)
294+
echo "Changed files in latest commit:"
295+
echo "$changed_files"
296+
297+
# Check if any files in the component path changed
298+
if echo "$changed_files" | grep -q "$component_path"; then
299+
echo "✅ Changes detected in component"
300+
should_deploy=true
301+
else
302+
echo "❌ No changes detected in component"
303+
fi
304+
fi
305+
fi
273306
274-
# If we're on main branch or there are changes in the component files, deploy
275-
if [[ -n "$last_change" && $(git rev-list HEAD^..HEAD | grep -c $last_change) -gt 0 ]]; then
276-
echo "⏳ Deploying $component_name (changes detected)..."
307+
if $should_deploy; then
308+
echo "⏳ Deploying $component_name..."
277309
278310
# Use our Python deployment script with additional logging
279-
PYTHONPATH=$PYTHONPATH:$(pwd) python -u scripts/snowflake_deployer.py deploy --profile $CONN_PROFILE --path "$component_path" --name "$component_name" --type "$component_type"
311+
PYTHONPATH=$PYTHONPATH:$(pwd) python -u scripts/deployment_files/snowflake_deployer.py deploy --profile $CONN_PROFILE --path "$component_path" --name "$component_name" --type "$component_type"
280312
281313
if [ $? -eq 0 ]; then
282314
echo "✅ Successfully deployed $component_name"
315+
316+
# If force deploy file exists, remove it after successful deployment
317+
if [[ -f "$component_path/.force_deploy" ]]; then
318+
echo "Removing force deploy marker"
319+
rm -f "$component_path/.force_deploy"
320+
fi
283321
else
284322
echo "❌ Deploy failed for $component_name"
285323
exit 1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ environment.json
1717
lambda_function.zip
1818
lambda_package/*
1919
!lambda_package/lambda_function.py
20+
.force_deploy

0 commit comments

Comments
 (0)