Skip to content

Move pages_path_prefix to pages.path_prefix

Kassio Borges requested to merge kassio/rename-pages_path_prefix-job-option into master

What does this MR do and why?

Move pages_path_prefix to pages.path_prefix

After some conversation about how to enable pages multiple jobs, we decided to, for now, only rename the pages_path_prefix to pages.path_prefix.

pages_path_prefix was introduced as a root job option, but now that we the vision that we want to concentrate all pages build options under the same pages: option for better organization and discoverability.

This will not have any impacts as the pages_path_prefix options is currently behind a disabled feature flag and undocumented. The documentation will be added on another MR.

Related to:

FAQ

  1. Why are we adding a pages option that can only be used on jobs named pages?

    Yes, this is a bit weird at first, but this is a step towards Enable multiple pages jobs (#427755 - closed). In intend to replace the job name requirement by this new pages option.

  2. Shouldn't we be updating documentation as well?

    The original pages_path_prefix documentation MR ( !130314 (merged)) wasn't finished when we decided to rename the field. So, I'll update that MR once this is merged with all the new information.

Screenshots or screen recordings

Screen_Recording_2023-10-17_at_18.51.08

How to set up and validate locally

  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 (to avoid having to configure private access) 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 👀
  7. Edit your gitlab-ci.yml adding the pages_path_prefix to the pages job:

    pages:
      stage: deploy
      pages:
        path_prefix: '$CI_COMMIT_BRANCH' # mr<iid>, like `mr123`
      script:
      - echo 'Nothing to do...'
      artifacts:
        paths:
        - public
      only:
      - master
  8. Run the pipeline again

  9. Go to rails console (bundle exec rails console) and check if the last PagesDeployment has the given prefix:

    [dev](main)> PagesDeployment.last.path_prefix
    => "master"
  10. Success! 🎉

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