Skip to content

Conversation

@lbussell
Copy link
Member

This pull request refactors the way operating system (OS) information is represented and used in image tests. The main change is replacing string-based OS identifiers with a strongly-typed OSInfo record.

This refactor sets the groundwork for more robust handling of OS versions in the test infrastructure.

Introduces OSInfo record with:
- OSType enum (Linux/Windows)
- OSFamily enum (Alpine, AzureLinux, Debian, Mariner, Ubuntu, NanoServer, WindowsServerCore)
- Version, TagName, DisplayName, IsDistroless properties
- Implicit string conversion for backward compatibility
- Static instances for all existing OS constants
- Update ImageData.OS property from string to OSInfo
- Update ProductImageData.SdkOS property from string to OSInfo
- Add Contains() and StartsWith() methods to OSInfo for backward compatibility
- Make OSType, OSFamily, and OSInfo public for use in test APIs
- Update all test data arrays to use OSInfo static instances
- Update pattern matching in ProductImageTests.cs to work with OSInfo
- Refactor GetZLibPackage to use OSFamily enum
- Make Version property required (non-nullable string)
- Remove un-versioned OSInfo instances (except AlpineFloating for samples)
- Use C# record 'with' expressions to derive related records:
  - Alpine versions from AlpineFloating
  - Distroless variants from base OS (AzureLinux, Mariner, Ubuntu)
  - Slim variant from Bookworm
  - Windows version variants from base versions
- Remove DisplayName from record constructor parameters
- Compute DisplayName from Family and Version using switch expression
- Remove DisplayName from all with expressions and constructor calls
- Add Codename parameter for OS base tag (e.g., 'jammy', 'bookworm', 'alpine')
- Add IsChiseled and IsSlim as constructor parameters (with defaults)
- Compute TagName from Family, Version, Codename, and variant flags
- Remove all TagName assignments from with expressions
- Simplify derived OS definitions to only specify changed properties
- IsChiseled is synonymous with IsDistroless for Ubuntu (chiseled suffix)
- All Debian images are slim (always append -slim suffix)
- Simplify TagName computation based on Family and IsDistroless
- Remove Bookworm (keep only BookwormSlim since all Debian is slim)
- Remove Codename from constructor parameters
- Add GetDebianCodename and GetUbuntuCodename helper methods
- Compute codename from version for Debian/Ubuntu in TagName property
- Simplify static OSInfo instance definitions
- Merge GetDebianCodename and GetUbuntuCodename into GetCodename
- Use tuple pattern matching on (OSFamily, version)
@lbussell lbussell requested a review from a team as a code owner December 22, 2025 22:06
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.

1 participant