Skip to content

Fix some sed substitutions in post-process script

Achilleas Pipinellis requested to merge axil-fix-normalize-script-replace into main

What does this MR do and why?

In !3701 (merged), we made the script more compact and quick by changing how sed substituted the strings. Unfortunately, some substitutions didn't follow the same regex as previously, and that led to having the SVGs not shown in the homepage.

You can verify by viewing the page source of https://docs.gitlab.com/15.11/ and searching for src="/assets. Normally, you shouldn't see any results as this should have been src="/15.11/assets.

Fortunately, this only affects the 15.11 image and folks that download and run it locally, which would be virtually no one 😄 After 15.11 gets in the archives, you would see this bug. We can prevent this though by backporting this change to 15.11.

This change brings back the substitutions that we used before, thus fixing the issue.

How to set up and validate locally

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

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.
  2. Pull the 15.11 image and run it locally:
    docker run -it --rm -p 4000:4000 registry.gitlab.com/gitlab-org/gitlab-docs:15.11
  3. Visit the site at http://0.0.0.0:4000 and notice the images not shown.
  4. Check out this branch.
  5. Build the 15.11 image with the new change:
    docker build --build-arg NANOC_ENV=production --build-arg VER=15.11 --build-arg SEARCH_BACKEND="lunr" --tag docs:15.11 -f dockerfiles/single.Dockerfile .
  6. Run the image:
    docker run -it --rm -p 4000:4000 docs:15.11
  7. Visit the site at http://0.0.0.0:4000 and verify that the images in the homepage show correctly.

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.

Edited by Achilleas Pipinellis

Merge request reports