Skip to content

Backport version path fixes to 15.6

Sarah German requested to merge 1633-asset-pathfix-backport-156 into 15.6

What does this MR do and why?

Backports this fix to 15.6: !3683 (merged)

When older versions move from docs.gitlab.com to archives.docs.gitlab.com/$VERSION, we need to change how asset paths are referenced from frontend code by doing two things:

  1. Rewrite search result paths in lunr_results.vue
  2. In our post-processing script, we need to update version prefixes in CSS and JS files (in addition to HTML files).

This also includes two other minor path-related fixes:

  1. The archives site URL in the versions menu should always point to https://docs.gitlab.com/archives (not relative)
  2. Requests to versions.json should always go to https://docs.gitlab.com/versions.json (not relative)

These should fix 404s for static assets, and also fix Lunr search.

Screenshots, screen recordings, or links to review app

See !3683 (merged)

How to set up and validate locally

Local test:

  1. Check out this branch
  2. Get dependencies into their older 15.x state: make setup
  3. Compile with Lunr: make clean && ALGOLIA_SEARCH="false" bundle exec nanoc compile && make build-lunr-index 3.5. Because this is 15.6, and nanoc had issues around this time, the last step may have crashed (this old problem: "Errno::EINVAL: Invalid argument @ io_write"). That's ok. Run these bits manually if it did: yarn bundle && make build-search-index
  4. Move the build to a subdirectory to emulate the archives site structure: mv public 15.6 && mkdir public && mv 15.6 public/
  5. Run the normalize-links script: ./scripts/normalize-links.sh "public" "15.6
  6. Turn on the web server (bundle exec nanoc view) and pull up http://localhost:3000/15.6

Checking for:

  • No 404s in the browser console
  • Running a search takes you to the results page and does not return any errors

Testing locally doesn't 100% verify that the script change does what it will in the Docker container, but because we validated that in the original MR, it should be OK to test outside of Docker for the sake of speed.

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports