Skip to content

Conversation

@adrienbernede
Copy link
Member

@adrienbernede adrienbernede commented Nov 3, 2025

Migrate to GitLab CI Components

Summary

This PR migrates the radiuss-shared-ci templates to GitLab CI Components (requires GitLab 17.0+). Components provide better versioning, type-safe inputs, and cleaner syntax compared to the previous template-based approach.

Motivation

The previous template-based CI system had several limitations:

  • No type safety for inputs
  • No built-in versioning support
  • Difficult to maintain consistency across projects
  • Complex include patterns with variable expansion issues

GitLab CI Components address these issues by providing:

  • Type-safe input specifications
  • Native versioning with @Version syntax
  • Better encapsulation and reusability
  • Cleaner project configurations

Changes Made

  1. Fixed Component Input Interpolation Issues
  • utility-draft-pr-filter: Removed intermediate variables; component inputs now used directly in scripts via $[[ inputs.xxx ]] syntax
  • utility-branch-skip: Same fix applied
  • base-pipeline: Fixed .machine-check template to use inputs directly for GitHub API calls

Rationale: Component input interpolation ($[[ inputs.xxx ]]) happens at include time. Storing these in intermediate variables and then referencing them caused the literal string $[[ inputs.xxx ]] to be stored instead of the actual value.

  1. Removed BUILD_ROOT Variable
  • Removed build_root input from all machine pipeline components (dane, matrix, corona, tioga, tuolumne, lassen)
  • Removed BUILD_ROOT variable assignments from machine pipeline templates
  • Updated reproducer scripts to use /tmp/ instead of ${BUILD_ROOT}/ for working directories

Rationale: BUILD_ROOT was set to ${CI_PROJECT_DIR} but evaluated to empty string because CI_PROJECT_DIR doesn't exist at component input resolution time. Investigation revealed BUILD_ROOT was never actually used in practice and is project-specific,
not something that should be managed by shared components.

  1. Removed component_version Input
  • Removed the component_version input from base-pipeline component
  • Removed RADIUSS_SHARED_CI_REF variable assignment from base-pipeline

Rationale: Component version should be specified in the component path using @Version syntax (e.g., @$RADIUSS_SHARED_CI_REF), not as a component input. Projects define RADIUSS_SHARED_CI_REF as a variable and use it consistently across all component

includes.

  1. Closes Should custom-jobs.yml be optional ? #61.

Component Structure

The migration creates the following components:

  • base-pipeline: Core templates (.machine-check, machine-specific templates like .dane, .matrix, etc.)
  • utility-draft-pr-filter: Draft PR detection and filtering
  • utility-branch-skip: Branch-based skip logic
  • dane-pipeline: Dane (SLURM) machine-specific pipeline
  • matrix-pipeline: Matrix (SLURM) machine-specific pipeline
  • corona-pipeline: Corona (Flux) machine-specific pipeline
  • tioga-pipeline: Tioga (Flux) machine-specific pipeline
  • tuolumne-pipeline: Tuolumne (Flux) machine-specific pipeline
  • lassen-pipeline: Lassen (LSF) machine-specific pipeline

Breaking Changes

For Projects Migrating to Components

  1. BUILD_ROOT removal: Projects should remove BUILD_ROOT: ${CI_PROJECT_DIR} from their .gitlab-ci.yml
  2. Component version usage: Projects should define RADIUSS_SHARED_CI_REF variable and use it in component paths:
    variables:
    RADIUSS_SHARED_CI_REF: "v2025.10.0"

include:
- component: $CI_SERVER_FQDN/radiuss/radiuss-shared-ci/base-pipeline@$RADIUSS_SHARED_CI_REF
3. Split configuration files: Projects should split .gitlab/custom-jobs-and-variables.yml into:
- .gitlab/custom-jobs.yml - Job templates (included in child pipelines)
- .gitlab/custom-variables.yml - Machine allocation variables (included in parent pipeline)

Migration Status

The following projects have been migrated to use these components, tests are ongoing:

Testing

All fixes have been validated through the migration of the above projects. Each project's migration includes:

  • Configuration file restructuring
  • Component version management
  • Removal of BUILD_ROOT references
  • Successful commit history with no CI configuration errors

Compatibility

  • Requires: GitLab 17.0+ (for CI Components feature)
  • Backward compatibility: Old template-based configurations continue to work unchanged
  • Migration path: Projects can migrate incrementally by updating to use components

adrienbernede and others added 18 commits October 28, 2025 00:47
- Create catalog-info.yml with component metadata
- Add templates directory structure for components
- Create initial machine-pipeline component template

This is the first step in migrating from include-based YAML files
to GitLab CI Components for better versioning and discoverability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Convert utilities/preliminary-ignore-draft-pr.yml to component
- Convert utilities/skip-branch-not-a-pr.yml to component
- Add spec inputs for GitHub configuration and branch patterns
- Maintain original functionality with improved parameterization

These components can now be consumed with type-safe inputs instead
of relying solely on environment variables.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Convert pipelines/performances.yml to component
- Add machine-specific performance templates (.perf_on_*)
- Include processing and reporting templates for GitHub integration
- Support Caliper-based benchmark conversion

Projects can now use this component to run performance measurements
with parameterized configuration instead of copy-pasting files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create lassen-pipeline component (LSF scheduler)
- Create dane-pipeline component (SLURM scheduler)
- Create matrix-pipeline component (SLURM scheduler)
- Create corona-pipeline component (flux scheduler)
- Create tioga-pipeline component (flux scheduler)
- Create tuolumne-pipeline component (flux scheduler)

Each component provides machine-specific job templates that
projects can extend, matching the original pipeline structure:
- .job_on_<machine> templates for regular jobs
- .on_<machine> rules for job control
- Reproducer templates for debugging
- Resource allocation/deallocation (SLURM/flux only)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create base-pipeline component with common templates
- Provides .machine-check template for availability checking
- Provides .build-and-test template for child pipeline triggers
- Provides .custom_job and .custom_perf templates
- Includes GitHub status reporting for machine availability

Projects can use this component to simplify their main .gitlab-ci.yml
by extending these templates instead of copying boilerplate code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create example .gitlab-ci.yml showing component usage
- Create example custom-jobs-and-variables.yml with allocations
- Create example jobs file for Lassen machine
- Demonstrate migration from include-based to component-based setup

These examples help projects understand how to adopt the new
component-based architecture.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add quick start guide for GitLab CI Components
- List all available components with descriptions
- Include code example showing component usage
- Note legacy include-based approach is still supported
- Reference examples directory for detailed configurations

This helps users understand the new component-based architecture
and how to adopt it in their projects.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create detailed migration documentation in Sphinx format
- Cover migration steps from legacy to component-based approach
- Document all component inputs and exported templates
- Include troubleshooting section for common issues
- Provide complete component reference documentation

This guide helps users understand how to migrate their projects
from the include-based approach to GitLab CI Components.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
BREAKING CHANGE: base-pipeline component no longer defines stages.

Users must now define required stages in their .gitlab-ci.yml:
  - prerequisites
  - build-and-test
  - performance-measurements

This is necessary because GitLab CI stage definitions override
rather than merge. The previous approach prevented users from
adding custom stages to their pipelines.

Changes:
- Remove stages: from base-pipeline component
- Add prominent documentation in component comments
- Update example .gitlab-ci.yml to show stage definition
- Update migration guide with new Step 1 for stages
- Add important note in component reference docs
- Update README quick start example

Machine pipeline components (lassen, dane, etc.) still define their
own stages because they run in isolated child pipelines.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
BREAKING CHANGE: The combined custom-jobs-and-variables.yml file has
been split into two files for clarity and to avoid duplication:

- custom-variables.yml - Variables only (parent pipeline)
- custom-jobs.yml - Job templates only (child pipelines)

Problem:
The old design required including custom-jobs-and-variables.yml twice:
1. In parent pipeline (for variables to pass as component inputs)
2. In child pipelines (for .custom_job templates)

This caused confusion because:
- Variables were duplicated (as vars AND as component inputs)
- Templates in parent were unused (only needed in child)
- It wasn't clear what was used where

Solution:
- custom-variables.yml: Included ONLY in parent .gitlab-ci.yml
- custom-jobs.yml: Included ONLY in child pipeline triggers

Benefits:
- Clear separation of concerns
- No duplication
- Obvious where each piece is used
- Variables flow: parent vars → component inputs → child pipeline

Changes:
- Delete examples/example-custom-jobs-and-variables.yml
- Add examples/example-custom-variables.yml
- Add examples/example-custom-jobs.yml
- Update examples/example-gitlab-ci.yml to use split files
- Update migration guide with new Step 5 explaining the split
- Add prominent note explaining the file split rationale

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Component inputs stored in variables weren't being properly interpolated,
causing scripts to receive literal "$[[ inputs.xxx ]]" strings instead of
actual values. This fix replaces all variable references with direct input
interpolation in scripts.

Changes:
- utility-draft-pr-filter: Remove intermediate variables, use inputs directly
- utility-branch-skip: Remove intermediate variables, use inputs directly
- base-pipeline: Use inputs directly in .machine-check template script

The machine pipeline templates (dane, matrix, corona, tioga, tuolumne, lassen)
still use the variables approach as those variables are consumed by child
pipeline jobs defined in separate files, making direct input interpolation
impractical.

According to GitLab documentation, $[[ inputs.xxx ]] should be interpolated
at component include time. Using inputs directly in scripts ensures the
interpolation happens correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
BUILD_ROOT was being set to ${CI_PROJECT_DIR}, but this variable doesn't
exist when component inputs are resolved (too early in the pipeline
lifecycle), causing BUILD_ROOT to be empty in child pipelines.

The BUILD_ROOT variable is project-specific and not needed by the
components themselves. Projects can define it locally if needed, but
it should not be part of component inputs.

Changes:
- Remove build_root input spec from all machine pipeline components
- Remove BUILD_ROOT variable assignment from all machine pipelines
- Replace ${BUILD_ROOT} with /usr/workspace/${USER} in default reproducer
  scripts for each machine (sensible default).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The intermediate variable usage is permitted when components are used in a child pipeline.
We leverage this as it allows to override this variable value in a given CI job for
customization purpose.
The component version should be specified in the component path using
the @Version syntax with a variable (e.g., @$RADIUSS_SHARED_CI_REF),
not as a component input.
@adrienbernede adrienbernede changed the title Migration to GitLab CI Components [WIP] Migration to GitLab CI Components Nov 3, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces GitLab CI Components as the recommended way to consume RADIUSS Shared CI configuration, replacing the legacy include-based approach. The components provide better versioning, type-safe inputs, cleaner syntax, and improved discoverability through the GitLab CI/CD Catalog.

  • Adds component templates for all machine pipelines (Lassen, Dane, Matrix, Corona, Tioga, Tuolumne) with scheduler-specific configurations
  • Implements utility components for draft PR filtering and branch skipping
  • Creates comprehensive documentation and migration guide for transitioning from legacy includes to components

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
templates/*/template.yml New component templates for all machine pipelines and utilities with standardized input specifications
examples/example-*.yml Example configurations demonstrating component usage patterns
docs/sphinx/user_guide/components_migration.rst Complete migration guide with troubleshooting and component reference documentation
docs/sphinx/user_guide/setup_ci.rst Updated to remove obsolete BUILD_ROOT variable reference
catalog-info.yml GitLab CI/CD Catalog metadata for component discovery
README.md Updated with component quick start guide and available components list
customization/gitlab-ci.yml Removed obsolete BUILD_ROOT variable from legacy template

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@tdrwenski tdrwenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is really cool! :D I am going to test it out on Quandary!

Copy link
Member Author

@adrienbernede adrienbernede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking action after reviews.

In example-custom-variables we set sensible defaults for allocation
variables.

In the machine specific components we don't set any default for job
alloc, forcing the users to find what's best for their use case.
@adrienbernede adrienbernede changed the title [WIP] Migration to GitLab CI Components Migration to GitLab CI Components Nov 4, 2025
Instead of suggesting that users should create a custom-variable file
with variables for each set of allocation parameters, we define sensible
defaults for the corresponding inputs of each component. Users only need
to change the input value, and might choose to gather such values
definition in dedicated file using variables (RADIUSS projects do so for
maintenance purpose).
We define a default for those templates so that user can get started
with using Shared CI more easily. Customization is still possible by
overriding the template, in a dedicated file include in the child
pipeline, or in each .gitlab/jobs/<machine>.yml.

We adapted the docs, the examples, and fixed some things.
Only run perf jobs for a given machine in allocation information was
provided.

By default the allocation information is empty, which will prevent the
jobs from running on this machine.

We split the config to create machine specific templates that allow to
apply the same behavior on other jobs the users may create for this
pipeline.

This is different than the `ON_MACHINE` variable since it only applies
to the performance pipeline and is not meant to be used globally: e.g.
pipeline jobs for a given machine cannot be turned off from the UI.
Copy link
Collaborator

@tdrwenski tdrwenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a few minor documentation related suggestions but overall looks good!

Migrating to GitLab CI Components
===================================

Starting with v2025.11.0, RADIUSS Shared CI provides GitLab CI Components as the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe check what release you want mentioned here and in the the components examples below (and throughout the template.yml examples)

@adrienbernede adrienbernede merged commit 3400592 into main Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should custom-jobs.yml be optional ?

3 participants