Skip to content

Ensure GitLab Pages upload is complete for deployment

Stan Hu requested to merge sh-fix-gitlab-pages-deploy into master

What does this MR do and why?

Prior to !135993 (merged), Projects::UpdatePagesService#create_pages_deployment would:

  1. Create an entry in pages_deployments.
  2. In the after_commit callback, upload the Pages ZIP file.
  3. Once this database entry as committed, update the project_pages_metadata to indicate the deployment was ready.

With !135993 (merged), step 3 is skipped and active deployments are scanned during a Pages path lookup. This led to an increased open-hit-error error rates, which causes intermittent 404s to occur after a deployment. The 404 would be gone after the ZIP file upload completed and the cache entry expired.

This commit defaults the pages_deployments.path_prefix column to a dummy value before the upload is complete. Once the upload is complete, reset the path_prefix to a blank value. This ensures that Pages::LookupPath#deployment will not prematurely use the deployment.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports