From 04bee7b6a73dfc67ccdb61ac4fbefc568607b558 Mon Sep 17 00:00:00 2001 From: Saravana Date: Mon, 28 Oct 2024 22:53:24 +0530 Subject: [PATCH] This reverts commit 6600709db496999f0bccbbcdb689f6b216561a79. --- controllers/status/status.go | 37 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/controllers/status/status.go b/controllers/status/status.go index 6ff4710deab..01cae2a5eff 100644 --- a/controllers/status/status.go +++ b/controllers/status/status.go @@ -20,7 +20,6 @@ package status import ( "path/filepath" - "strings" "github.com/blang/semver/v4" conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" @@ -307,37 +306,29 @@ func GetReleaseVersion(defaultManifestPath string, componentName string) Compone var componentVersion semver.Version var repositoryURL string var displayName string - var componentStatusMeta ComponentReleaseStatus - var componentsReleaseStatus []ComponentReleaseStatus env, err := common.ParseParams(filepath.Join(defaultManifestPath, componentName, ".env")) if err != nil { return ComponentStatus{} } - for key, value := range env { - switch { - case strings.Contains(key, "release-version"): - componentVersion, err = semver.Parse(value) - - if err != nil { - return ComponentStatus{} - } - case strings.Contains(key, "repository-url"): - repositoryURL = value - case strings.Contains(key, "display-name"): - displayName = value - } - componentStatusMeta = ComponentReleaseStatus{ + + componentVersion, err = semver.Parse(env["RHOAI_RELEASE_VERSION"]) + + if err != nil { + return ComponentStatus{} + } + repositoryURL = env["REPOSITORY_URL"] + + displayName = env["DISPLAY_NAME"] + + return ComponentStatus{ + Releases: []ComponentReleaseStatus{{ Name: componentName, DisplayName: displayName, Version: version.OperatorVersion{Version: componentVersion}, RepoURL: repositoryURL, - } - } - componentsReleaseStatus = append(componentsReleaseStatus, componentStatusMeta) - - return ComponentStatus{ - Releases: componentsReleaseStatus, + }, + }, } }