Draft: feat: add OS deprecation warning banner

Relates to issue #517674

Changes

This MR implements an OS deprecation warning banner system for GitLab administrators to alert them when their operating system is approaching end-of-life.

Core Components

OS Support Checker Service (lib/gitlab/os_support_checker.rb)

  • Uses Ohai gem to detect OS platform and version
  • Reads EOL data from supported_os_data.yml
  • Calculates months until EOL date
  • Returns status hash with OS information and support status
  • Handles version matching (exact and major version)

Admin OS Support Helper (app/helpers/admin/os_support_helper.rb)

  • show_os_deprecation_banner? - Shows banner only to admins when EOL ≤6 months away
  • os_banner_variant - Returns :warning for 6 months, :danger for ≤3 months
  • os_banner_dismissible? - Returns false when ≤1 month until EOL
  • os_banner_message - Generates appropriate message based on time until EOL

Banner View Partial (app/views/admin/dashboard/_os_deprecation_banner.html.haml)

  • Uses Users::DismissibleAlertComponent when dismissible
  • Uses Pajamas::AlertComponent when non-dismissible (≤1 month)
  • Applies correct variant (warning/danger) based on time until EOL

Integration Points

Dashboard Integration (app/views/admin/dashboard/index.html.haml)

  • Banner rendered on admin dashboard after web_ide_oauth_callback_mismatch_callout

Controller (app/controllers/admin/dashboard_controller.rb)

  • Assigns @os_support_status from OS Support Checker
  • Includes Admin::OsSupportHelper

Callout System

  • Added os_deprecation_banner: 120 enum to app/models/users/callout.rb
  • Added OS_DEPRECATION_BANNER constant to app/helpers/users/callouts_helper.rb

Banner Behavior

  1. No banner shown if EOL is more than 6 months away
  2. Orange (warning) dismissible banner if EOL is 6 months away
  3. Red (danger) dismissible banner if EOL is 3 months away
  4. Red (danger) non-dismissible banner if EOL is 1 month away
  5. Only shown to administrators (current_user.can_admin_all_resources?)

Test Coverage

  • OS Support Checker Specs - Tests OS detection, YAML parsing, EOL calculations, error handling
  • Helper Specs - Tests all helper methods for various scenarios
  • View Specs - Tests banner rendering for different time periods and user types
  • Controller Specs - Tests @os_support_status assignment
  • Callout Model Specs - Tests enum value

Additional Files

Sample OS Data File (supported_os_data.yml)

  • Contains sample EOL data for Ubuntu, Debian, AlmaLinux, Rocky, CentOS, RHEL, Amazon Linux, openSUSE Leap, and SLES
  • Serves as reference/example (actual file will be provided by omnibus-gitlab)
Edited by Balasankar 'Balu' C

Merge request reports

Loading