Skip to content

Draft: Add version prefix to nav links at build time

Achilleas Pipinellis requested to merge axil-version-prefix-build-time into main

What does this MR do and why?

When running the normalize-links.sh to replace the URLs, this takes a lot of time.

Most of the links to replace come from the navigation bar. What if we just added the needed version prefixes during build time?

This MR adds a version_prefix helper method that can be used to determine if we are on a stable branch. If so, then we add the prefix to the links in the nav.

Related issues

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. When run locally (CI_COMMIT_REF_NAME is not defined) or in CI on a non-stable branch (CI_COMMIT_REF_NAME is defined), it should behave as before:

    make compile
    CI_COMMIT_REF_NAME=main make compile
  3. When run in CI on a stable branch (CI_COMMIT_REF_NAME is defined), it should add the version prefix to the nav URLs:

    CI_COMMIT_REF_NAME=16.5 make compile

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