Clean environment before deploying review app
Update script to clean out old environment before redeploying.
Before any deployment, run the command to delete everything in the environment, in case there was a previous deployment already.
Tested with gitlab!102355 (closed) (test MR):
-
First deployment: Attempts to delete, but nothing found, then deploys as normal. Review app works, showing first version.
-
Second (re)deployment: Deletes all the files from the last deployment, then deploys as normal. Review app updated, showing second version.
https://gitlab.com/gitlab-org/gitlab-docs/-/jobs/3240372098
$ scripts/deploy-review-app Starting deploy for review app. Activated service account credentials for: [docs-gitlab-review-app@group-marketing-49659d.iam.gserviceaccount.com] [...snip...] Making sure review app environment in gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355 is empty... gsutil -m rm -r "gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355" Removing gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355/404.html.gz#1666918675191193... Removing gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355/404.html#1666918675416725... Removing gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355/assets/fonts/fontawesome-webfont.woff2#1666918794907545... Removing gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355/assets/images/404.png#1666918793063032... Removing gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355/archives/index.html#1666918677360337... [...snip...] Removing gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355/versions.json.gz#1666918675186787... / [4.9k/4.9k objects] 100% Done 41.70 objects/s ETA 00:00:00 Operation completed over 4.9k objects. Deploying review app to gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355... gsutil -h "Cache-Control:public, max-age=60" -m cp -z css,html,js,txt -c -r "public/" "gs://docs.gitlab-review.app/fix-review-app-redeployments-ee-102355" Copying file://public/sitemap.xml [Content-Type=application/xml]... Copying file://public/robots.txt [Content-Type=text/plain]... Copying file://public/versions.json [Content-Type=application/json]...
Edited by Marcel Amirault