Repository navigation
Description
Summary
The knowledge of the Konflux application naming convention (acs-<major>-<minor>) and of version parsing is encoded in several places. Today (while reviewing get-merge-window/list-merge-windows, PR #70) we added yet another encoding, which prompted this issue: the convention should have a single home.
Current state
The same concepts exist as parallel types and parsers:
| Concept | Location | Notes |
|---|---|---|
Application (name helpers) |
pkg/utils/application.go |
WithVersion(tag) builds acs-4-8 from a tag; GetVersion() parses an application name back into a version; GetResourceWithVersion, GetPipelineRunURL |
Version (major/minor/patch) |
pkg/utils/version.go |
NewVersion parses semver strings; convertToVersion; RenderTags |
ProductStream (major/minor) |
pkg/client/konflux/models.go |
NewProductStream parses "4.6" strings |
| Application-name pattern | pkg/client/konflux/applications.go |
applicationNamePattern (^acs-(\d+)-(\d+)$) filters/parses application names into product streams |
| Application prefix | pkg/config/config.go |
KonfluxApplicationPrefix = "acs" |
Concretely, the name → version direction alone is implemented twice with slightly different semantics:
utils.Application.GetVersion()— splits on-, accepts any 3-part name (collector-4-6parses fine), returnsutils.VersionwithPatch: 0konflux/applications.go— regex anchored to theacsprefix, returnskonflux.ProductStream
And the version → name direction (WithVersion) lives only in utils, while ProductStream has no way to render its application name (the merge-window code builds release-<major>.<minor> branch names instead, in pkg/github/github.go).
Problem
- The convention can drift: a change to how application names are built or parsed must be replicated in
pkg/utilsandpkg/client/konflux. - Two overlapping version types (
utils.Versionvskonflux.ProductStream) force conversions and make it unclear which to use in new code. - Prefix knowledge (
acs) is sometimes hardcoded in logic and sometimes read fromconfig.KonfluxApplicationPrefix.
Proposal
Consolidate the naming convention and version types into one place, e.g. on the konflux package's domain types (import direction already works: pkg/client/konflux imports pkg/utils today, and pkg/utils does not import pkg/client/konflux):
- conversion methods between
ProductStream,utils.Version, and application names (e.g.ProductStream.ApplicationName(),NewProductStreamFromVersion,ProductStreamFromApplicationName) - one anchored application-name pattern used by both enumeration (
GetActiveProductStreams) and parsing utils.Application/utils.Versioneither delegate to the consolidated implementation or are absorbed into it, with callers updated (pkg/konflux,pkg/client/konflux,cmd/relacs/konflux)
Acceptance criteria
- A single implementation knows how to build/parse
acs-<major>-<minor>application names - A single version-ish type hierarchy (or explicit conversion) instead of parallel
utils.Version/konflux.ProductStreamparsers - The
acsprefix comes fromconfig.KonfluxApplicationPrefixeverywhere - Existing behavior of tag-driven commands (
get-custom-snapshot, releases, conforma, etc.) is unchanged, covered by the existing tests inpkg/utilsandtests/
Activity