Skip to content

Commit

Permalink
fix: make date offset calculation platform agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
jta committed Jan 16, 2024
1 parent 57c71f1 commit 404ba6c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ endif
@echo "Copying packaged.yaml to S3"
aws s3 cp $(SAM_BUILD_DIR)/$(APP)/$(AWS_REGION)/packaged.yaml s3://$(S3_BUCKET_PREFIX)-$(AWS_REGION)/apps/$(APP)/$(VERSION)/
@echo "Fetching objects with prefix: apps/$(APP)/$(VERSION)/ and filtering by last modified date"
@current_date=`date -u +"%Y-%m-%dT%H:%M:%SZ"`; \
week_ago=`date -u -v-7d +"%Y-%m-%dT%H:%M:%SZ"`; \
# calculate a week ago in platform agnostic manner
@current_date_seconds=`date -u +"%s"`; \
one_week_ago_seconds=$$((current_date_seconds - 7 * 24 * 3600)); \
week_ago=`date -u -r "$$one_week_ago_seconds" +"%Y-%m-%d%H:%M:%SZ"`; \
objects=`aws s3api list-objects --bucket $(S3_BUCKET_PREFIX)-$(AWS_REGION) --prefix apps/$(APP)/$(VERSION)/ --query "Contents[?LastModified>='$$week_ago'].[Key]" --output text`; \
for object in $$objects; do \
echo "Setting ACL for object: $$object"; \
Expand Down

0 comments on commit 404ba6c

Please sign in to comment.