ci: Add the `hugolint` job.
Objective
Reduce the number of broken / dangling links in the handbook by informing users about breakage at MR review time.
Background
I noticed that there is a high number of broken links in the handbook. Many of them are due to pages getting moved around, either within the handbook or to the internal-only handbook.
By providing MR authors with a automated feedback, we can significantly improve the health of the handbook.
What / How
I have written a small utility called "hugolint". At the moment its only function is to perform a static link analysis, i.e. it only checks links within the handbook; external links are ignored. Because the static analysis is local, it is very quick and can check the entire handbook in about two seconds.
The tools emits a "code quality" artefact (example result). These artefacts are integrated nicely with the MR view, showing problems newly introduced by the MR. For example, authors of new content get quick feedback that a link they're putting into a page doesn't exist. When moving a page, the code quality report will highlight all pages that currently link to the old location.
For more information on the "Code Quality" artefacts, see https://docs.gitlab.com/ee/ci/testing/code_quality.html#view-code-quality-results
Caveats
This is a first iteration that has some known limitations:
- The
content/
directory is assumed to be the web root. This is not universally true, for example for assets in thestatic/
directory. - Not all
handbook.gitlab.com
content is in this repository, e.g.https://handbook.gitlab.com/docs/
. Such links are currently false positives. - Pages with spaces in their name are currently ignored. This affects one page.
Author and Reviewer Checklist
Please verify the check list and ensure to tick them off before the MR is merged.
-
Provided a concise title for this Merge Request (MR) -
Added a description to this MR explaining the reasons for the proposed change, per say why, not just what - Copy/paste the Slack conversation to document it for later, or upload screenshots. Verify that no confidential data is added, and the content is SAFE
-
Assign reviewers for this MR to the correct Directly Responsible Individual/s (DRI) - If the DRI for the page/s being updated isn’t immediately clear, then assign it to one of the people listed in the
Maintained by
section on the page being edited - If your manager does not have merge rights, please ask someone to merge it AFTER it has been approved by your manager in #mr-buddies
- The when to get approval handbook section explains the workflow in more detail
- If the DRI for the page/s being updated isn’t immediately clear, then assign it to one of the people listed in the
-
For transparency, share this MR with the audience that will be impacted. -
Team: For changes that affect your direct team, share in your group Slack channel -
Department: If the update affects your department, share the MR in your department Slack channel -
Division: If the update affects your division, share the MR in your division Slack channel -
Company: If the update affects all (or the majority of) GitLab team members, post an update in #whats-happening-at-gitlab linking to this MR - For high-priority company-wide announcements work with the internal communications team to post the update in #company-fyi and align on a plan to circulate in additional channels like the "While You Were Iterating" Newsletter
-
Commits
- ci: Add the
hugolint
job.