Skip to content

Exclude checking of some internal links based on env

Achilleas Pipinellis requested to merge internal-links-env into master

With the advent of the global navigation bar, we link to relative URLs that may not be available when building the website for only one product. For example, if the site is built with only CE in mind, the global nav bar will also have links to EE-only docs (/ee/*) which will not be present in the compiled site.

The internal link checker will fail in those situations, so we configure Nanoc to exclude different links on different environments.

To run the internal check on a specific environment:

bundle exec nanoc check internal_links --env=<env>

<env> can take the following values:

  • gitlab-ce
  • gitlab-ee
  • omnibus
  • runner

The environment names are picked so that CI_PROJECT_NAME can be used in .gitlab-ci.yml without the need to duplicate the docs lint job. We can run the same command from all products:

bundle exec nanoc check internal_links --env=$CI_PROJECT_NAME

Testing

  1. I pushed a test Docker image at https://gitlab.com/gitlab-com/gitlab-docs/container_registry (registry.gitlab.com/gitlab-com/gitlab-docs/test/docs:lint) that includes the changes in the MR.
  2. I created an MR in CE using that Docker image https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23700
  3. The check links job finished successfully https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/132923739

Related issues

Closes https://gitlab.com/gitlab-com/gitlab-docs/issues/305

Edited by Achilleas Pipinellis

Merge request reports