Skip to content

Draft: Add Pages to Usage Quotas

Janis Altherr requested to merge janis-add-pages-to-usage-quotas into master

What does this MR do and why?

This MR adds Pages Deployments to the usage quotas tab. This MR only adds the statistics card, the deployment details will be added in a later MR for easier review.

Screenshots or screen recordings

Screenshot_2024-06-21_at_14.45.58

How to set up and validate locally

  1. Set up your GDK to support Runners and Pages
  2. Enable the multi version feature flag with echo "Feature.enable(\"pages_multiple_versions_setting\")" | rails c
  3. Inside a group, create a Pages project, by creating a new project with the "pages/Plain HTML" template.
  4. Replace the below config in the .gitlab-ci.yml:
image: busybox

pages:
  stage: deploy
  script:
    - echo "Pages accessible through ${CI_PAGES_URL}/${PAGES_PREFIX}"
  variables:
    PAGES_PREFIX: "" # no prefix by default (master)
  pages:
    path_prefix: "$PAGES_PREFIX"
  artifacts:
    paths:
    - public
  rules:
    - if: $CI_COMMIT_BRANCH == "master" # ensure to run on master (with default PAGES_PREFIX)
      variables:
        PAGES_PREFIX: '' # prefix with _stg for the staging branch
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" # conditionally change the prefix on Merge Requests
      variables:
        PAGES_PREFIX: 'mr$CI_MERGE_REQUEST_IID' # prefix with the mr<iid>, like `mr123`
  1. Ensure the pipeline runs successfully and you have a pages deployment
  2. Create one or more MRs in the project. Ensure each MR's pipeline creates a Pages deployment.
  3. In the group's sidebar, visit Settings > Usage Quotas > Pages. The statistics card should now show the number of extra deployments (the one related to an MR) as a partial of a total limit.
Edited by Janis Altherr

Merge request reports