From cc6681ee63b75058bd996cf43c01f2cd9abd1637 Mon Sep 17 00:00:00 2001 From: Eli Battat Date: Mon, 13 Jan 2025 12:01:02 +0200 Subject: [PATCH] Update get odf version --- benchmark_runner/common/oc/oc.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/benchmark_runner/common/oc/oc.py b/benchmark_runner/common/oc/oc.py index dd95912b..d277aed5 100644 --- a/benchmark_runner/common/oc/oc.py +++ b/benchmark_runner/common/oc/oc.py @@ -165,10 +165,15 @@ def get_cnv_version(self): def get_odf_version(self): """ - This method returns odf version - :return: + This method returns the ODF version by extracting it from the csv name. + :return: ODF version as a string (e.g., '4.17.2') """ - return self.run(f"{self.__cli} get csv -n openshift-storage -o jsonpath='{{.items[0].spec.labels.full_version}}'") + # OCP 4.16 and below + if self.get_ocp_major_version() <= 4 and self.get_ocp_minor_version() <= 16: + command = f"{self.__cli} get csv -n openshift-storage -o jsonpath='{{.items[0].spec.labels.full_version}}'" + else: + command = f"{self.__cli} get csv -n openshift-storage -o jsonpath='{{range .items[*]}}{{.metadata.name}}{{\"\\n\"}}{{end}}' | grep odf-operator | sed -E 's/odf-operator.v([0-9]+\\.[0-9]+\\.[0-9]+)-rhodf/\\1/'" + return self.run(command) def remove_lso_path(self): """