From 86be8c3dd91e57dc5dd1bfbc1fbdf209883c5e9e Mon Sep 17 00:00:00 2001 From: Zhenya Vinogradov Date: Wed, 29 Apr 2020 11:43:51 +0300 Subject: [PATCH] Deployment: run `aws cp` before `aws sync` to replace existing files `aws s3 sync` compares file size and timestamps to decide if a file in the bucket needs to be replaced, but all files in nix store have timestamp=1. So if a new file happens to have the same size as the old one, `aws s3 sync` would decide that it does not need to be updated. Run `aws cp` before `aws sync` to update existing files unconditionally --- .buildkite/pipeline.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 9f54ad6..443196e 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -21,6 +21,9 @@ steps: commands: - nix-build -A nixfmt-webdemo - nix run -f . awscli -c - aws s3 sync --delete result/ "$CDN_BUCKET" + aws s3 cp --recursive result/ "$CDN_BUCKET" + # delete files that don't exist anymore, use `--size-only` so behavior won't depend on local file timestamps + - nix run -f . awscli -c + aws s3 sync --delete --size-only result/ "$CDN_BUCKET" - nix run -f . awscli -c aws cloudfront create-invalidation --distribution-id "$CDN_DISTRIBUTION_ID" --paths '/*' -- 2.45.2