2.x: Reduce number of variables in GitLab CI Templates

Created on 12 April 2024, 12 months ago

Problem/Motivation

Currently we have a very large number of variables in the template. Some make sense as they have to be present for GitLab to make decisions before any custom code executes, others less so.

On a cursory glance:

  • CORE_STABLE
  • CORE_SECURITY
  • CORE_SECURITY_PREVIOUS_MINOR
  • CORE_SUPPORTED
  • CORE_MINOR
  • CORE_NEXT_MINOR
  • CORE_MAJOR_DEVELOPMENT
  • CORE_PREVIOUS_STABLE
  • CORE_PREVIOUS_SECURITY
  • CORE_LEG_STABLE
  • CORE_LEG_PATCH
  • CORE_LEG_MINOR

These are intended to be used in conjunction with _TARGET_CORE and are only needed for composer or other uses inside of a running container. These could be converted to a lookup table. If the value of $_TARGET_CORE matches a value in the table we pull the version and use that, if not we pass through the value raw.

  • CORE_PHP_MIN
  • CORE_PHP_MAX
  • CORE_PHP_NEXT
  • CORE_NEXT_PHP_MIN
  • CORE_NEXT_PHP_MAX
  • CORE_NEXT_PHP_NEXT
  • CORE_PREVIOUS_PHP_MIN:
  • CORE_PREVIOUS_PHP_MAX:

If we work with DrupalCi Enviroments,we could take the images with these as constants. This could allow us to use these as constant strings. We could still keep one global "PHP_IMAGE_NAME" variable to allow easy overriding in GitlabCi runs without modifying the we would track the images closer to release dates. A maintainer owner could still always override with a specific release by setting $_TARGET_PHP_VERSION to a specific version or tag name.

  • CORE_MYSQL_MIN
  • CORE_MYSQL_MAX
  • CORE_MYSQL_NEXT
  • CORE_MYSQL_TEST_DEFAULT
  • CORE_LEG_MYSQL_MIN
  • CORE_LEG_MYSQL_MAX
  • CORE_LEG_MYSQL_NEXT
  • CORE_LEG_MYSQL_TEST_DEFAULT
  • CORE_MARIADB_MIN
  • CORE_MARIADB_MAX
  • CORE_MARIADB_NEXT
  • CORE_MARIADB_MIN_TEST_DEFAULT
  • CORE_LEG_MARIADB_MIN
  • CORE_LEG_MARIADB_MAX
  • CORE_LEG_MARIADB_NEXT
  • CORE_LEG_MARIADB_MIN_TEST_DEFAULT
  • CORE_PGSQL_MIN
  • CORE_PGSQL_MAX
  • CORE_PGSQL_NEXT
  • CORE_LEG_PGSQL_MIN
  • CORE_LEG_PGSQL_MAX
  • CORE_LEG_PGSQL_NEXT
  • CORE_SQLITE_MIN
  • CORE_SQLITE_MAX
  • CORE_SQLITE_NEXT
  • CORE_LEG_SQLITE_MIN
  • CORE_LEG_SQLITE_MAX
  • CORE_LEG_SQLITE_NEXT

These would be the same as PHP, make them a part of the image name.

The list above is itself 48 variables, or roughly 55% of the set variables when running a pipeline.

The biggest negatives I can see to this are:

  • It may make using external images (like woodby4drupal) a bit harder, however Drupal Dedicated repo's (or mirrors) could add the tags to make it easier to work with gitlab_templates. Worst case a maintainer could set values and use monitoring tools to open MR's to change tags as needed.
  • When you pin a project to a specific gitlab_templates release the PHP Containers would still move, however that already occurs to some degree as we only have two tags (prod and dev) for each container line.

Steps to reproduce

Proposed resolution

Convert many variables to constants that are resolved outside of GitLabCi

Remaining tasks

Discuss if this is possible
Work with necessary repo's to implement docker image naming changes

User interface changes

Decrease in variables visible when running a pipeline.

API changes

Removal of lookup variables.
Require using a lookup table inside running container.

Data model changes

New lookup table

πŸ“Œ Task
Status

Active

Component

gitlab-ci

Created by

πŸ‡ΊπŸ‡ΈUnited States cmlara

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

Comments & Activities

  • Issue created by @cmlara
  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    Added bonus of using constants:

    We can add

    variables:
      DROPDOWN_CORE_VERSION:
        value: "CORE_STABLE"
        options:
          - "CORE_STABLE"
          - "CORE_MINOR"
          - "CORE_NEXT_MINOR"
          - "etc"
    

    While setting _TARGET_CORE: $DROPDOWN_CORE_VERSION.

    This would add a few extra variables (Core/PHP Release/DB Type yet at the same time it would make the pipeline significantly more usable for the average user while still allowing power customization of $_TARGET_CORE.

  • Status changed to Postponed 12 months ago
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    I like the idea suggested for simplifying options (vastly). We currently have +100 variables and I'm sure that many of them were there as a just in case and they are not even used by the templates code even, so we'll need to do a deep review of them and see which will be offered in the future.

    As of right now, we are not thinking about a 2.x version of the templates yet, so I'll mark this as posponed.

  • Status changed to Active 3 months ago
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    We have a good number of issues tagged with 2.x, so I'm reopening this one too so we can see the full picture of where we are at.

Production build 0.71.5 2024