Skip to content

Commit

Permalink
merge: #4041
Browse files Browse the repository at this point in the history
4041: feat: remove artifact cache invalidation r=sprutton1 a=sprutton1

Invalidate, inschmalidate. [This PR](systeminit/si-ci#128) should remove the need for us to do this on each deploy.


Co-authored-by: Scott Prutton <scott@systeminit.com>
  • Loading branch information
si-bors-ng[bot] and sprutton1 authored Jun 26, 2024
2 parents 35be650 + d0f8260 commit 0f785ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 50 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/deploy-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
aws-region: us-east-1

- name: Deploy web
id: deploy-web
if: ${{ inputs.service == 'web' }}
run: |
ENVIRONMENT="${{ inputs.environment }}"
Expand Down Expand Up @@ -80,6 +79,20 @@ jobs:
exit 1
fi
- name: Invalidate web cache
if: ${{ inputs.service == 'web' }}
run: |
ENV=${{ inputs.environment }}
DIST_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='$ENV-cdn'].Id | [0]" --output text)
# Create a CloudFront invalidation for all objects (/*)
invalidation_id=$(aws cloudfront create-invalidation --distribution-id $DIST_ID --paths "/*" --query 'Invalidation.Id' --output text)
# Check the status of the invalidation until it's completed
while [[ "$(aws cloudfront get-invalidation --distribution-id $DIST_ID --id $invalidation_id --query 'Invalidation.Status' --output text)" != "Completed" ]]; do
echo "Invalidation is still in progress. Waiting..."
sleep 5
done
echo "Invalidation is complete."
- name: Deploy service
if: ${{ inputs.service != 'web' }}
run: |
Expand Down Expand Up @@ -149,11 +162,3 @@ jobs:
echo "Version $VERSION for $SERVICE not found in the artifacts registry. Skipping!"
exit 1
fi
invalidate-cache:
if: ${{ inputs.service == 'web' }}
needs: deploy
uses: ./.github/workflows/invalidate-cache.yml
with:
environment: ${{ inputs.environment }}
secrets: inherit
8 changes: 1 addition & 7 deletions .github/workflows/deploy-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ on:
default: "stable"

jobs:
invalidate-cache:
uses: ./.github/workflows/invalidate-cache.yml
with:
environment: shared
secrets: inherit

set-init:
uses: ./.github/workflows/set-init-version.yml
with:
Expand All @@ -70,7 +64,7 @@ jobs:
fi
deploy-services:
needs: ["invalidate-cache", "define-deployment-matrix"]
needs: "define-deployment-matrix"
strategy:
fail-fast: false
matrix:
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/invalidate-cache.yml

This file was deleted.

0 comments on commit 0f785ed

Please sign in to comment.