Only rebuild documentation pages when source has changed

Created on 17 February 2025, 3 months ago

Problem/Motivation

From this thread https://drupal.slack.com/archives/C51GNJG91/p1739624656083539 I realised that the rules for contrib pages are different from what we have in Gitlab Templates own pages job.

The rules for running the contrib pages job are

  rules:
    - *skip-pages-rule
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
      when: never
    - exists:
        - mkdocs.yml
      when: on_success

This only checks the branch and that docs files exist, it does not check that a push has triggered the pipeline. Which means we are wasting resources by rebuilding and deploying pages on every scheduled pipeline even when the docs source has not been changed.

For Gitlab Templates own implementation that rule is expanded to

  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_ROOT_NAMESPACE == "project"
      changes:
        - docs/**/*
        - mkdocs.yml  

which means that the documentation is only rebuilt when a change to any page is being commited to the default branch. This enhancement could be made to the Contrib pipeline too,.

https://drupal.slack.com/archives/C08CJ9K74MB/p1739788321405979

Proposed resolution

Remaining tasks

Enhance the rule
Update the documentation - when do the jobs run

📌 Task
Status

Active

Component

gitlab-ci

Created by

🇬🇧United Kingdom jonathan1055

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024