Skip to content

Commit 47ed032

Browse files
committed
SDKQE-3638: Fix to support reading ReleaseId for GCP cluster
1 parent a77b7a5 commit 47ed032

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

deployment/clouddeploy/helper.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,17 @@ func isServiceEqual(services1 []capellacontrol.ClusterInfo_Service, services2 []
9191
}
9292

9393
func getReleaseIdFromServerImage(serverImage string) (string, error) {
94-
lastIndex := strings.LastIndex(serverImage, ".")
94+
// GCP images don't contain "." instead they have "-" and therefore cbdino is not able to
95+
// read release ID for gcp images. Example of gcp image: "couchbase-cloud-server-7-6-5-5724-v1-0-53"
96+
// and example of aws image: "couchbase-cloud-server-7.6.5-5724-arm64-v1.0.53"
97+
formattedServerImage := strings.ReplaceAll(serverImage, "-", ".")
98+
lastIndex := strings.LastIndex(formattedServerImage, ".")
9599
if lastIndex == -1 {
96100
// "." not found, handle error
97101
return "", errors.New(fmt.Sprintf("ServerImage is not in expected format"))
98102
}
99103
// The release ID is formed by combining the number after the last dot in the server image with "1.0.".
100-
releaseNumberStr := serverImage[lastIndex+1:]
104+
releaseNumberStr := formattedServerImage[lastIndex+1:]
101105

102106
// Validate if the release number is a valid integer
103107
releaseNumber, err := strconv.Atoi(releaseNumberStr)

0 commit comments

Comments
 (0)