Add `pages_path_prefix` job option
What does this MR do and why?
Add pages_path_prefix job option
As part of the introduction of the GitLab Pages Multiple Versions
Support, we need to introduce pages_path_prefix as a pages job option on
gitlab CI.
This is a iteration step towards the GitLab Pages Multiple Versions pages_path_prefix on PagesDeployment records.
The PagesDeployment#path_prefix was added on !128930 (merged).
This value will be used on Add versioned pages sites to pages internal API (#416494 - closed)
Related to: #416492 (closed)
Changelog: added
Screenshots or screen recordings
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- You need a license (https://about.gitlab.com/handbook/developer-onboarding/#working-on-gitlab-ee-developer-licenses)
- You need GitLab Runner (https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/runner.md?ref_type=heads)
- Enable
pages_multiple_versions_settingfeature flag - Create a project using the
htmltemplate (root/htmlfor example`) - Run the pipeline on that project (to ensure the pages is created)
- 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 pagesURL to see your GitLab Pages site👀
- Disable
- Edit your
gitlab-ci.ymladding thepages_path_prefixto thepagesjob:pages: stage: deploy pages_path_prefix: 'mr$CI_MERGE_REQUEST_IID' # mr<iid>, like `mr123` script: - echo 'Nothing to do...' artifacts: paths: - public only: - master - Run the pipeline again
- Go to rails console (
bundle exec rails console) and check if the lastPagesDeploymenthas the given prefix:[dev](main)> PagesDeployment.last.path_prefix => "mr2" - 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.
-
I have evaluated the MR acceptance checklist for this MR.