Skip to content

Update Pages 'custom domains' error to provide a path to the existing project, if available

Ben King requested to merge benjaminking-pages-domains into master

What does this MR do and why?

The code changes introduce a new validation to the creation of custom domains for GitLab Pages. Now, when a user attempts to create a custom domain that already exists, the service will check if the user has access to the project that owns the domain.

  • If the user has access, it will display a more specific error message indicating that the domain is already in use by that project.
  • If the user doesn't have access, it will display a generic error message indicating that the domain is already in use by another project.

References

Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Demo Video:

2024-10-28-benjaminking-pages-demo

How to set up and validate locally

  1. Setup GDK with GitLab Pages. Ensure custom domains are enabled for the instance.
  2. Create and connect GitLab Runner, which will deploy a GitLab Pages pipeline.
  3. Create two projects, which can be under the root user namespace. For example: root/pages & root/pages1.
  4. In the first project, deploy a Pages project template. Run the pipeline and confirm under Deploy > Pages, that the Pages deployment was successful.
  5. Using an external DNS provider (such as Cloudflare), connect an actual existing domain to your GDK instance for testing purposes. Complete TXT validation and ensure the domain is verified.
  6. In the second project, deploy a Pages project template. Run the pipeline and confirm under Deploy > Pages, that the Pages deployment was successful.
  7. Now, try to configure a custom domain using the same value as the first project. This should handle case insensitivity, such as Example.com and example.com.
  8. If the user has access to the first project, it should provide the path to the project.
  9. If the user doesn't have access to the first project, it should provide the generic error.

Merge request reports

Loading