Version Constraints for Multi-Version Images
Overview
Version constraints prevent unwanted major or minor version updates for multi-version
container images (e.g., python-3-11, nodejs-20). Constraints are defined in
properties.yml and validated during make check by comparing VERSION files against
defined patterns.
Adding Version Constraints
Edit the image’s properties.yml to add a version constraint:
---
main_package: python3.11
version_constraints: '3.11.*' # Allow 3.11.X, block 3.12+ and 4.X
The constraint applies to all distros for the image:
---
main_package: dotnet-sdk-8.0
version_constraints: '8.*' # Applies to rawhide, hummingbird, and any other distros
Constraint Patterns
Constraints use glob-style patterns:
3.11.*- Match any 3.11.X version (recommended for version families)20.*- Match any 20.X version8.*- Match any 8.X version1.25.*- Match any 1.25.X version (for Go-style 3-part versions)
The pattern matches against the version from the VERSION file. For example, if the
VERSION file contains 3.11.14, the constraint 3.11.* will match.
How Validation Works
- Lockfile Generation: When
make allruns, lockfiles are generated with resolved package versions - VERSION File Creation:
generate_jinja2.pycreates VERSION files from resolved package versions - Constraint Checking: When
make checkruns,check_version_constraints.pyvalidates VERSION files against constraints - Failure: If a violation is detected, the build fails with a detailed error message
- Renovate Integration: Renovate MRs that violate constraints fail CI and are blocked from automerge
Handling Constraint Violations
When a build fails due to a version constraint violation, you have several options:
Option 1: Accept the new version (create new image)
If the new major/minor version is acceptable:
-
Create a new image directory (e.g.,
images/python-3-14/) -
Copy properties and configuration from the old version
-
Update the constraint in the new directory:
version_constraints: '3.14.*' -
Update
repositoryfield to group versions together -
Consider adding
latesttag to the new version if appropriate
Option 2: Block the version update (exclude package)
If the new version should be blocked entirely:
- Add the package to
yum-repos/*.repoexcludepkgs - Follow the procedure in Excluding Packages from Images
- Renovate will skip the excluded version in future updates
- When the issue is resolved, remove the exclusion
Option 3: Update the constraint (allow version bump)
If the version bump is acceptable for the existing image:
-
Update the constraint in
properties.yml:version_constraints: '3.12.*' # Allow 3.12.X now -
Consider if this changes the image’s purpose (major version change)
-
Update image documentation and tags accordingly
-
Consider renaming the image directory to reflect the new version
Examples
Python Multi-Version Images
# images/python-3-11/properties.yml
distros:
- hummingbird
main_package: python3.11
repository: python
version_constraints: '3.11.*'
# images/python-3-13/properties.yml
distros:
- hummingbird
main_package: python3.13
repository: python
version_constraints: '3.13.*'
Node.js Multi-Version Images
# images/nodejs-20/properties.yml
main_package: nodejs20
repository: nodejs
version_constraints: '20.*'
# images/nodejs-24/properties.yml
main_package: nodejs24
repository: nodejs
version_constraints: '24.*'
.NET SDK Multi-Version Images
# images/dotnet-sdk-8-0/properties.yml
main_package: dotnet-sdk-8.0
repository: dotnet-sdk
version_constraints: '8.*'
.NET Runtime Multi-Version Images
# images/dotnet-runtime-8-0/properties.yml
main_package: dotnet-runtime-8.0
repository: dotnet-runtime
version_constraints: '8.*'
ASP.NET Runtime Multi-Version Images
# images/aspnet-runtime-8-0/properties.yml
main_package: aspnetcore-runtime-8.0
repository: aspnet-runtime
version_constraints: '8.*'
OpenJDK Multi-Version Images
# images/openjdk-21/properties.yml
main_package: java-21-openjdk-headless
repository: openjdk
version_constraints: '21.*'
Go Multi-Version Images (3-part versions)
# images/go-1-25/properties.yml
main_package: golang1.25
repository: go
distros:
- hummingbird
version_constraints: '1.25.*' # Matches 1.25.0, 1.25.3, etc.
Troubleshooting
Constraint not working
- Verify package name matches exactly (case-sensitive)
- Ensure pattern syntax is correct (use
*wildcard) - Run
make allto regenerate VERSION files beforemake check
False positive violations
- Check for typos in the constraint pattern
- Verify the pattern matches the version format (e.g.,
3.11.*not3.11*) - Ensure you’re using glob patterns, not regex
Package renamed in repositories
If a package is renamed (e.g., python3.11 → python311):
- Update
main_packagefield - Update constraint with new package name (not needed - constraints check VERSION files)
- Regenerate lockfiles and VERSION files with
make all
Implementation Details
The version constraint system consists of:
- properties.yml: Optional
version_constraintsfield with a glob pattern string - ci/check_version_constraints.py: Python script that validates VERSION files
- Makefile integration: Script runs as part of
make check - CI integration: Failures block merge, including Renovate automerge
The validation process:
- Reads
properties.ymlfor each image - If
version_constraintsdefined, finds all VERSION files across all distros - Applies the same constraint pattern to all distros for the image
- Compares VERSION file content against glob pattern using Python’s
fnmatch - Reports violations with file path, version, constraint, and properties file location
- Exits with error code 1 if any violations found
See Also
- Image Configuration Reference - Complete
properties.ymlfield reference - Excluding Packages from Images - How to exclude problematic package versions
- Switching Fedora Streams - How to pin distro versions