Improve how reviews apps redeploy by using rsync
This is an improved fix, following up from !3222 (merged)
Related to #735 (comment 1152386294)
Instead of deleting everything on redeployment, we can use rsync
to just update whatever has changed. Note that some flags changed, though the functionality is identical:
-
cp
flags: https://cloud.google.com/storage/docs/gsutil/commands/cp#options -
rsync
flags: https://cloud.google.com/storage/docs/gsutil/commands/rsync#options
Therefore:
-
gsutil cp -z
->gsutil rsync -j
-
gsutil cp -c
->gsutil rsync -C
- Also note:
gsutil rsync -d
-> If files are deleted in the source, also delete them in the destination (we sometimes delete images/files in later commits, so we should delete during rsync to match the files exactly).
Testing
- First deployment: Runs fine - https://gitlab.com/gitlab-org/gitlab-docs/-/pipelines/680997519
- Redeployment: Runs fine, and review app verified to be showing the test changes I pushed - https://gitlab.com/gitlab-org/gitlab-docs/-/pipelines/681008995
- Second redeployment after pulling test changes: https://gitlab.com/gitlab-org/gitlab-docs/-/pipelines/681018626
Edited by Marcel Amirault