Skip to content

Expose the versioned pages site URL during the ci build

What does this MR do and why?

Make the CI_PAGES_URL variable always return the full deployment URL, including path_prefix

Currently the CI_PAGES_URL only returns the main pages deployment path. If the user leverages parallel deployments, it does not include the user-specified path_prefix. This MR moves the creation of said variable to models/build.rb where we have access to the job spec to be able to deduct the full deployment URL from (ahead of its deployment). We also leverage the Gitlab::Pages::UrlBuilder that generates the path for real after the pages deployment has been build so we have a SSOT for the deployment URL spec.

Introduce a new variable CI_PAGES_HOSTNAME with the full projects domain, not just the instance default

The existing CI_PAGES_DOMAIN variable always returned the instance's pages domain, not the project's domain. Seeing as this has been there for a while, I thought it safe to keep this behaviour as-is and instead introduce a new variable CI_PAGES_HOSTNAME that returns the full domain.

refactor the Gitlab::Pages::UrlBuilder

The above changes required major changes in the Gitlab::Pages::UrlBuilder, which had organically grown to include more and more functionalities and special use-cases. I took this as an opportunity to refactor the class to a more declarative instead of a functional style. this will allow easier maintenance for future changes such as what might result from #498446

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

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.

Related to #416493 (closed)

Edited by Janis Altherr

Merge request reports

Loading