86be8c3dd91e57dc5dd1bfbc1fbdf209883c5e9e — Zhenya Vinogradov 3 years ago ccfd9da
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
1 files changed, 4 insertions(+), 1 deletions(-)

M .buildkite/pipeline.yml
M .buildkite/pipeline.yml => .buildkite/pipeline.yml +4 -1
@@ 21,6 21,9 @@ steps:
      - 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 '/*'