[Evergreen-general] Automating Antora documentation builds on GitLab

Dan Scott dan at coffeecode.net
Thu Dec 30 11:44:31 EST 2021


I took things a little further today.

The GitLab docs build now includes the Evergreen CSS, header, and footer.
The UI bundle is currently sourced from a pinned job from an automated
build of the "evergreen" branch of the Antora default UI (
https://gitlab.com/denials/antora-ui-default/-/tree/evergreen [1]) I set up.

The UI bundle is currently in my GitLab namespace for testing purposes but
it would be easy to move the repository to GitLab's
evergreen-library-system group. I suggest mirroring the
Antora/antora-ui-default main branch (GitLab makes mirroring trivial) and
keeping our customizations in an "evergreen" branch to avoid merge hassles,
etc.

If we were willing to rely on GitLab's automated builds, we could remove
docs/generate_docs.pl and replace docs/site.yml. We wouldn't need to
maintain a special server to build and serve the Evergreen documentation.
We could even have GitLab serve up the docs.evergreen-ils.org domain, given
that Evergreen 3.6 marks the first Antora-based documentation and is
currently in "only security fix mode". Or we could continue to serve up
docs.evergreen-ils.org on our own server along with the legacy docs by
automating the downloading & unzipping of the artifacts bundle (all the
HTML/CSS/JS/media) GitLab creates with each build.

Depending on how far we wanted to go with GitLab integration, we could also
unhide the "Edit this page" link on every page of the Evergreen
documentation that leads to the corresponding file in the GitLab repository
and the web IDE. That might be a lower bar for basic documentation
contributions (e.g. fixing typos or adding a clarification) than our
current footer's suggestion to email the DIG list (which, based on the list
archives, doesn't seem to be attracting many contributions). Edits made via
the Web IDE create a merge request (& potentially a branch) per
https://docs.gitlab.com/ee/user/project/web_ide/#commit-changes so
contributors wouldn't have to learn git mechanics to edit existing files.

On Wed, 29 Dec 2021 at 14:30, Dan Scott <dan at coffeecode.net> wrote:

> I was exploring GitLab's CI/CD (continuous integration / delivery)
> functionality last night/this morning and decided to try building our
> Antora-based documentation this way with the output hosted on GitLab Pages.
>
> It works quite nicely. I've posted a rough implementation branch at
> https://gitlab.com/evergreen-library-system/evergreen-library-system/-/commits/gitlab-antora-build
>
> As you can see, it's just a couple of YAML files; .gitlab-cy.yml defines
> the "pages" step, and .gitlab-antora.yml defines a custom Antora playbook
> for the Docker environment. The CI/CD piece means that a new build would be
> triggered by every commit.
>
> The output is visible at
> https://evergreen-library-system.gitlab.io/evergreen-library-system/docs/latest/index.html
>
> It's nice to see the current list of build errors, such as missing
> references or media files, at a glance:
> https://gitlab.com/evergreen-library-system/evergreen-library-system/-/jobs/1927489146
>
> If we decided to merge this, we would want to modify the configuration so
> that it only watches a given branch (our main branch, most likely), rather
> than triggering a new build for every commit  on every branch. But most of
> the doc build could also be reused as an integration test to be run against
> every branch / merge request. If a test fails, then the merge request gets
> flagged, the errors get reported as a comment right on the branch/merge
> request (instead of having to dig into the job details), and the branch
> could be blocked from merging until the problem is resolved.
>
> I'm using the Node.js npx command to avoid having to globally install the
> npm modules. npx is a nice way to avoid conflicts between requirements for
> different module versions at the global level and to avoid having to run
> commands as root. When you prefix a command with "npx", such as "npx
> antora", it searches for the command within the local project's
> node_modules path instead of globally. Could be useful elsewhere in
> Evergreen.
>
> Notes:
> * I updated the build process to use the just-released Antora 3 and the
> corresponding Antora lunr-extension.
> * I have not applied the Evergreen customizations of CSS, the header menu,
> or the contact DIG message in the footer. Antora 3 has moved to
> "extensions" which are lighter weight than our current approach of cloning
> and tweaking the Antora default UI repository.
> * In addition to the basic "does Antora build the docs without errors"
> integration test, we could add a style checker like Vale (
> https://gitlab.com/jdkato/vale) as another test for the documentation.
> Vale can flag spelling errors (with a custom dictionary of course) and
> grammatical issues like passive voice, etc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.evergreen-ils.org/pipermail/evergreen-general/attachments/20211230/0573fe98/attachment.html>


More information about the Evergreen-general mailing list