Skip to content
Snippets Groups Projects

Add Multiversion support to Pages internal API

Merged Kassio Borges requested to merge kassio/add-multiple-version-pages-on-lookup-paths into master
All threads resolved!

What does this MR do and why?

Add Multiversion support to Pages internal API

With the work to introduce Gitlab Pages Multiple Versions, a project now have to support multiple PagesDeployment at the same time.

For this reason, instead of using ProjectPagesMetadatum#pages_deployment_id to identify valid deployment the PagesDeployment#deleted_at field was introduced.

Now, when multiple versions is enabled for the project, we're making all the active PagesDeployment available to GitLab Pages render.

Related to: #416494 (closed)

Changelog: changed

PS.: A big portion of the original change was extracted to: Serve pages deployments without going through P... (!135993 - merged)

Screenshots or screen recordings

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

Screen_Recording_2023-11-13_at_18.54.27

  • I tried to edit the file without in edit mode :see_no_evil:
  • The 404 in the recording is because I was faster the the deploy itself, that's why the reload made it work. :runner:

How to set up and validate locally

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

  1. You need a license (https://about.gitlab.com/handbook/developer-onboarding/#working-on-gitlab-ee-developer-licenses)
  2. You need GitLab Runner (https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/runner.md?ref_type=heads)
  3. Enable pages_multiple_versions_setting feature flag
  4. Create a public project using the html template (root/html for example)
  5. Run the pipeline on that project (to ensure the pages is created)
  6. Navigate to Settings > Pages (http://gdk.test:3000/root/html/pages, for example)
    • Disable Force HTTPS (requires valid certificates)
    • Enable Use multiple versions
    • [optional] Click on the Access pages URL to see your GitLab Pages site :eyes:
  7. Edit your gitlab-ci.yml adding the pages_path_prefix to the pages job:
     image: busybox
    
     pages:
       stage: deploy
       pages:
         path_prefix: "$PAGES_PREFIX"
       artifacts:
         paths:
         - public
       script:
       - echo "This pages version will have this prefix > $PAGES_PREFIX <"
       - echo "Pages accessible through > ${CI_PAGES_URL}/${PAGES_PREFIX} <"
       variables:
         PAGES_PREFIX: "" # no prefix by default (master)
       rules:
         - if: $CI_COMMIT_BRANCH == "master" # ensure to run on master (with default PAGES_PREFIX)
         - 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`
  8. Create a merge request editing the public/index.html file
  9. When the merge request pipeline finishes, access the pages link printed on the pages job output. It looks something like (with mr at the end): http://root.pages.gdk.test:3000/html/mr1

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 Kassio Borges

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Contributor
    2 Warnings
    :warning: 79a84329: The commit subject must start with a capital letter. For more information, take a look at our Commit message guidelines.
    :warning:

    featureaddition and featureenhancement merge requests normally have a documentation change. Consider adding a documentation update or confirming the documentation plan with the Technical Writer counterpart.

    For more information, see:

    Reviewer roulette

    Changes that require review have been detected!

    Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:

    Category Reviewer Maintainer
    backend @hmerscher profile link current availability (UTC+1, 1 hour ahead of author) @mayra-cabrera profile link current availability (UTC-6, 6 hours behind author)

    Please check reviewer's status!

    • available Reviewer is available!
    • unavailable Reviewer is unavailable!

    Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.

    To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.

    Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    Generated by :no_entry_sign: Danger

  • Kassio Borges added 1169 commits

    added 1169 commits

    Compare with previous version

  • Kassio Borges resolved all threads

    resolved all threads

  • Kassio Borges added 13 commits

    added 13 commits

    Compare with previous version

  • Kassio Borges changed the description

    changed the description

  • Kassio Borges added 13 commits

    added 13 commits

    Compare with previous version

  • Kassio Borges added 1 commit

    added 1 commit

    • eef2b2ce - Add Multiversion support to Pages internal API

    Compare with previous version

  • Kassio Borges changed the description

    changed the description

  • Kassio Borges requested review from @janis

    requested review from @janis

  • Kassio Borges marked this merge request as ready

    marked this merge request as ready

  • Kassio Borges mentioned in commit 58384757

    mentioned in commit 58384757

  • 🤖 GitLab Bot 🤖 changed milestone to %16.7

    changed milestone to %16.7

  • Janis Altherr approved this merge request

    approved this merge request

  • Janis Altherr removed review request for @janis

    removed review request for @janis

  • Janis Altherr
  • Kassio Borges added 1 commit

    added 1 commit

    • 872c7797 - Rename back to lookup_paths (plural)

    Compare with previous version

  • Contributor

    @kassio Some end-to-end (E2E) tests should run based on the stage label.

    Please start the trigger-omnibus-and-follow-up-e2e job in the qa stage and ensure tests in the follow-up-e2e:package-and-test-ee pipeline pass before this MR is merged. (E2E tests are computationally intensive and don't run automatically for every push/rebase, so we ask you to run this job manually at least once.)

    To run all E2E tests, apply the pipeline:run-all-e2e label and run a new pipeline.

    E2E test jobs are allowed to fail due to flakiness. See current failures at the latest pipeline triage issue.

    Once done, apply the :white_check_mark: emoji on this comment.

    Team members only: for any questions or help, reach out on the internal #quality Slack channel.

  • Kassio Borges requested review from @vyaklushin

    requested review from @vyaklushin

  • Vasilii Iakliushin
  • Kassio Borges added 1 commit

    added 1 commit

    • 79a84329 - use `find` instead of `select` for better performance

    Compare with previous version

  • Vasilii Iakliushin approved this merge request

    approved this merge request

  • Vasilii Iakliushin resolved all threads

    resolved all threads

  • Vasilii Iakliushin enabled an automatic merge when the pipeline for 10c42b66 succeeds

    enabled an automatic merge when the pipeline for 10c42b66 succeeds

  • mentioned in commit a444a9f9

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading