lablup / lablup/backend.ai

Extend Version Pattern Support for rc, post, alpha, beta formats

Open
#5,984 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Motivation

The current `_rx_ver` regex pattern in `src/ai/backend/common/docker.py:366` only supports basic version formats like `\d+(?:\.\d+)*[a-z0-9]*`, which fails to parse common version suffixes such as `rc1`, `post2`, `alpha3`, `beta1`. This limitation prevents proper parsing and display of legitimate container image versions that follow semantic versioning conventions with pre-release or post-release identifiers.

## Required Features

- **Extend** `_rx_ver` pattern: Update regex to support rc, post, alpha, beta, dev version suffixes
- **Maintain parsing accuracy**: Ensure version components are correctly extracted and separated
- **Support complex versions**: Handle patterns like `2.1-rc1`, `3.0.0-post2`, `1.5-alpha3`
- **Preserve existing functionality**: Keep current version parsing working for standard formats
- **Enhanced GUI display**: Enable structured label display for extended version formats

## Impact

### Primary Components

- `src/ai/backend/common/docker.py:366` - `PlatformTagSet._rx_ver` pattern
- Platform tag parsing and validation logic
- GUI tag display components that depend on version parsing

### Services Affected

- Image tag parsing during registry scanning
- Frontend multi-label tag display logic
- Image metadata extraction and storage

## Testing Scenarios

### Version Pattern Tests

- Parse `pytorch:2.1-rc1` correctly as platform=pytorch, version=2.1-rc1
- Handle `tensorflow:2.12.0-post1` as platform=tensorflow, version=2.12.0-post1
- Support `numpy:1.24-alpha2` as platform=numpy, version=1.24-alpha2
- Process `scipy:1.10-beta3` as platform=scipy, version=1.10-beta3

### Complex Version Tests

- Multi-component versions: `3.9.18-rc2`
- Development versions: `2.0-dev20231201`
- Release candidates with patches: `1.5.2-rc1`

### Backward Compatibility Tests

- Ensure existing version formats continue parsing correctly
- Verify standard semantic versions work: `1.0.0`, `2.1.3`
- Test current Backend.AI image versions remain functional

JIRA Issue: BA-2459

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.