fix(installer): handle parsePlatformSourceURL error, restore variant validation

Check error from parsePlatformSourceURL instead of discarding it, preventing
silent fallback to OCIRepository on invalid URLs.

Move variant validation from deleted packagesource.yaml to
cozystack-operator.yaml template so invalid cozystackOperator.variant
values still fail at helm template/install time.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin 2026-02-19 17:42:31 +03:00
parent 655133b81c
commit 0e8b6515af
No known key found for this signature in database
GPG key ID: 7988329FDF395282
2 changed files with 9 additions and 1 deletions

View file

@ -225,7 +225,11 @@ func main() {
// Create platform PackageSource that references the source resource
setupLog.Info("Creating platform PackageSource", "platformSourceName", platformSourceName)
sourceType, _, _ := parsePlatformSourceURL(platformSourceURL)
sourceType, _, err := parsePlatformSourceURL(platformSourceURL)
if err != nil {
setupLog.Error(err, "failed to parse platform source URL for PackageSource creation")
os.Exit(1)
}
sourceRefKind := "OCIRepository"
if sourceType == "git" {
sourceRefKind = "GitRepository"