Skip to content

WIP: Simulate the internal_check tests that run on all products

Achilleas Pipinellis requested to merge internal-links-ci-new into master

What this solves

Nanoc provides a nanoc check internal_links command that we use to test whether all the internal links are valid.

As we build the site, some elements of one product might be dependent on another product. This is fine on gitlab-docs since we test for all of them, but can be problematic on the single projects where we only have the relevant project present.

The content that we check may be different, but the Docker image that we use for those tests is the same (includes the master version of the gitlab-docs project).

One recent example, which this MR is based on, is the addition of the global navigation bar, where 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.

In the gitlab-docs project we check for all products (CE/EE/Omnibus/Runner). In CE we check only for the CE internal links, in EE only for EE internal links, and so on.

This MR introduces jobs that simulate the environment of the single projects, and the internal link checker runs as it would run on CE/EE/Omnibus/Runner.

How it works

The internal link checker will fail in those situations, so we configure the global nav to be compiled only if the ENABLE_GLOBAL_NAV variable is set to true in layouts/default.html.

In order to simulate exactly how the job is running in the upstream projects, we skip building all products except the one we're testing. This is done by setting the SKIP_<SLUG> variable in the Rakefile.

SKIP_<SLUG> can take the following values:

  • SKIP_CE
  • SKIP_EE
  • SKIP_OMNIBUS
  • SKIP_RUNNER

You can see the relevant tasks with rake -T:

rake test:gitlab_ce           # Simulate internal links checking of gitlab-org/gitlab-ce
rake test:gitlab_ee           # Simulate internal links checking of gitlab-org/gitlab-ee
rake test:gitlab_runner       # Simulate internal links checking of gitlab-org/gitlab-runner
rake test:omnibus             # Simulate internal links checking of gitlab-org/omnibus

So, for example, to simulate the internal links checking of CE, you would run:

bundle exec rake test:gitlab_ce

Related issues

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

Edited by Achilleas Pipinellis

Merge request reports