Skip to content

Move Multiple Deployments limit from top-level namespace to project if `unique_domain` is enabled.

What does this MR do and why?

This MR introduces the first set of changes required to display a tab for Pages Deployments on a project level. So far, the pages usage quota was measured on a namespace level, but with #458159, we'll move it to project level whenever the project's "use unique domain" setting is enabled.

Note: This MR only prepares the Vue frontend to be used on a project level. It requires the application of a git patch to become visible in the UI.

Screenshots or screen recordings

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

Before After
n/a Screenshot_2024-12-12_at_22.32.54

How to set up and validate locally

  1. Set up your instance to support runners and pages.
  2. Create a project under a namespace that has an ultimate license by using the "Pages / Plain HTML" template
  3. Make the deployment create parallel deployments by using the following .gitlab-ci.yml:
image: busybox

pages:
  stage: deploy
  script:
    - echo "Pages accessible through ${CI_PAGES_URL}"
  pages: true
  artifacts:
    paths:
    - public
  rules:
  - if: $CI_COMMIT_BRANCH == "master"

review-pages:
  stage: deploy
  script:
    - echo "Pages accessible through ${CI_PAGES_URL}"
  pages: 
    path_prefix: 'mr$CI_MERGE_REQUEST_IID'
  artifacts:
    paths:
    - public
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
  1. run the pipeline once.
  2. create 1-2 mrs to the project (don't merge them)
  3. go to Deploy > Pages and ensure you have a main deployment and as many parallel deployments as you created MRs
  4. Apply the below patch:
Index: ee/app/views/projects/usage_quotas/_pages.html.haml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ee/app/views/projects/usage_quotas/_pages.html.haml b/ee/app/views/projects/usage_quotas/_pages.html.haml
new file mode 100644
--- /dev/null	(date 1733930347685)
+++ b/ee/app/views/projects/usage_quotas/_pages.html.haml	(date 1733930347685)
@@ -0,0 +1,1 @@
+#js-pages-deployments-app{ data: pages_deployments_app_data(@project) }
Index: app/views/projects/usage_quotas/index.html.haml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/views/projects/usage_quotas/index.html.haml b/app/views/projects/usage_quotas/index.html.haml
--- a/app/views/projects/usage_quotas/index.html.haml	(revision 6139a938a7c839a08ac4ac49fbec7555bb3f08d8)
+++ b/app/views/projects/usage_quotas/index.html.haml	(date 1733930347688)
@@ -16,5 +16,6 @@
   #js-storage-usage-app{ data: { project_path: @project.full_path } }
   = render_if_exists 'projects/usage_quotas/transfer_tab_content'
   = render_if_exists 'shared/usage_quotas/tabs_content/observability'
+  = render_if_exists 'projects/usage_quotas/pages'
 
 = render 'shared/usage_quotas/index'
  1. Go to Settings > Usage Quotas, select the Pages tab and verify it works. it should show only the parallel deployments, not the main deployment.

Related to #458159

Edited by Janis Altherr

Merge request reports

Loading