Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update get ODF version #956

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions benchmark_runner/common/oc/oc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down