diff --git a/api/ocm/extensions/repositories/genericocireg/component.go b/api/ocm/extensions/repositories/genericocireg/component.go index 13ca88c56..5d96b32db 100644 --- a/api/ocm/extensions/repositories/genericocireg/component.go +++ b/api/ocm/extensions/repositories/genericocireg/component.go @@ -128,10 +128,6 @@ func (c *componentAccessImpl) HasVersion(vers string) (bool, error) { } func (c *componentAccessImpl) LookupVersion(version string) (*repocpi.ComponentVersionAccessInfo, error) { - // LookupVersion '0.0.1-20250108132333.build-af79499' would fail with: - // unable to unref last: unable to cleanup component version [%v] while unref last: closing component version [%v]: check failed: component version [%v] is invalid - // This is because the version comes from an artifact tag, which doesn't allow '+' characters, which we replace with '.build-' during the push - version = toVersion(version) // ensure the cv doesn't contain '.build-' tag, err := toTag(version) if err != nil { return nil, err diff --git a/api/ocm/extensions/repositories/genericocireg/componentversion.go b/api/ocm/extensions/repositories/genericocireg/componentversion.go index e0dd0f547..b36470f1a 100644 --- a/api/ocm/extensions/repositories/genericocireg/componentversion.go +++ b/api/ocm/extensions/repositories/genericocireg/componentversion.go @@ -102,6 +102,14 @@ func (c *ComponentVersionContainer) SetReadOnly() { func (c *ComponentVersionContainer) Check() error { if c.version != c.GetDescriptor().Version { + // check if version contained '+' which has been replaced by META_SEPARATOR to create OCI compliant tag + if replaced, _ := toTag(c.GetDescriptor().Version); replaced != c.GetDescriptor().Version && replaced == c.version { + Logger(c.GetContext()).Warn(fmt.Sprintf( + "checked version %q contains %q, this is discouraged and you should prefer the original component version %q", c.version, META_SEPARATOR, c.GetDescriptor().Version)) + return nil + } else { + return errors.ErrInvalid("component version", c.GetDescriptor().Version) + } return errors.ErrInvalid("component version", c.GetDescriptor().Version) } if c.comp.name != c.GetDescriptor().Name {