Change workflow: into a re-usable reference that can be extended

Created on 3 February 2025, 2 months ago

Problem/Motivation

The workflow: definition is hard-coded in includes/include.drupalci.workflows.yml. Every one of these conditions is a positive test for when a pipeline should run. If a project wants to add another condition to this list, then currently the only to do this is duplicate the entire workflow: defintion and add the new rule. This is tedious, but also duplication means any fixes in gitlab_templates will not be available in the copy.

The example which prompted this is #3503337-14: Plan for initial codebase but also there are other cases, in other projects.

Proposed resolution

In the above file, convert workflow: to a reusable .default-workflow: &default-workflow then define workflow: to reference this.

Other projects can then define something like (untested) :

workflow:
  rules:
    - !reference [ .default-workflow ]
    - if: $CI_COMMIT_BRANCH == "some-specific-branch"
Feature request
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

Merge Requests

Comments & Activities

Production build 0.71.5 2024