Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b75cfff
X-Smart-Branch-Parent: master
jschnath Nov 8, 2022
b1dda77
Add sensorversions.py script (WIP)
jschnath Oct 26, 2022
e92a30e
Add TODOs for remaining changes
jschnath Oct 26, 2022
b870acf
Finish quay tag querying
jschnath Oct 28, 2022
347a12d
Add git tag API query
jschnath Oct 28, 2022
da3d579
Make functions that don't need exposure private
jschnath Oct 28, 2022
1b7f9c8
Separate tag syntax filtering between git and quay tags
jschnath Oct 28, 2022
ac0c621
Add Git CLI version fetching
jschnath Oct 28, 2022
bba20f1
Refactor
jschnath Oct 28, 2022
ab00749
Remove API methods for getting tags, remove underscores in functions
jschnath Nov 4, 2022
b9716e6
Remove main function
jschnath Nov 4, 2022
0a22356
Rename sensorversions.py to sensor_versions.py to follow python namin…
jschnath Nov 8, 2022
6ddd356
Use sensor_versions.py to grab the latest sensor versions for compati…
jschnath Nov 8, 2022
9936fd3
make tag within sensor_versions.py script to get MAIN_IMAGE_TAG
jschnath Nov 8, 2022
fed49f7
Change function names to underscores instead of camel case
jschnath Nov 14, 2022
1568159
Split split_version into two functions
jschnath Nov 14, 2022
8f28b02
Refactor and simplify using dict
jschnath Nov 14, 2022
793544e
Ensure that no sensor versions newer than central get tested
jschnath Nov 14, 2022
0bce4cf
Rename main script function to be less verbose
jschnath Nov 14, 2022
6b8bf85
Readd main function
jschnath Nov 14, 2022
7bf3c44
Add "--quiet" and "--no-print-directory" to make tag call
jschnath Nov 14, 2022
d43ffc0
Rename functions to make them shorter
jschnath Nov 14, 2022
1021b41
Use is not None instead of bool() cast
jschnath Nov 14, 2022
963eebe
Remove unused variable
jschnath Nov 14, 2022
731d912
Shorten filter_tags function
jschnath Nov 14, 2022
04de0f9
Inline cli_output_to_tags function
jschnath Nov 14, 2022
d8a469b
compare major and minor versions
jschnath Nov 14, 2022
fea9ce4
make script executable
jschnath Nov 14, 2022
653bccf
Constrain regex search more
jschnath Nov 14, 2022
44be872
Split get_latest_tags into two functions
jschnath Nov 14, 2022
cb63286
Import only the function get_latest_release_versions instead of the w…
jschnath Nov 15, 2022
f9b6049
rename mainimagetag to tag
jschnath Nov 15, 2022
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
53 changes: 53 additions & 0 deletions .openshift-ci/get_latest_release_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python3

"""
Returns the latest patches of the last n major versions
"""

import sys
import re
import subprocess
from collections import defaultdict

def is_release_tag(version):
return re.search(r"^\d+\.\d+\.\d+$", version) is not None

def filter_tags(rawtags):
return set([t for t in rawtags if is_release_tag(t)])

def reduce_tags_to_latest_patch(tags):
top_patch_version = defaultdict(int)
for t in tags:
[major, minor, patch] = t.split('.')
k = '.'.join([major, minor])
top_patch_version[k] = max(top_patch_version[k], int(patch))
top_major_versions = sorted(list(top_patch_version.keys()), reverse=True)
return [t + '.' + str(top_patch_version[t]) for t in top_major_versions]

def make_image_tag():
return subprocess.check_output(["make", "--quiet", "--no-print-directory", "tag"]).decode(encoding="utf-8")

def extract_x_y_from_main_image_tag(tag):
x_y = re.search(r"^(\d+)\.(\d+)", tag)
return int(x_y.group(1)), int(x_y.group(2))

def get_latest_n_tags(tags, num_versions):
central_major, central_minor = extract_x_y_from_main_image_tag(make_image_tag())
tags_older_than_central = [t for t in tags if (int(t.split('.')[0]) < central_major or (int(t.split('.')[0]) == central_major and int(t.split('.')[1]) <= central_minor))]
return tags_older_than_central[:num_versions]

# get_latest_release_versions gets the latest patches of the last num_versions major versions via Git CLI
def get_latest_release_versions(num_versions):
rawtags = subprocess.check_output(["git", "tag", "--list"]).decode(encoding="utf-8").splitlines()
tags = filter_tags(rawtags)
latest_patch_tags = reduce_tags_to_latest_patch(tags)
return get_latest_n_tags(latest_patch_tags, num_versions)

def main(argv):
n = int(argv[1]) if len(argv)>1 else 4
latestversions = get_latest_release_versions(n)
print(f"Last {n} versions:")
print("\n".join(latestversions))

if (__name__ == "__main__"):
main(sys.argv)
5 changes: 2 additions & 3 deletions scripts/ci/jobs/gke_version_compatibility_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Run version compatibility tests
"""
import os
from get_latest_release_versions import get_latest_release_versions
from compatibility_test import make_compatibility_test_runner
from clusters import GKECluster

Expand All @@ -13,12 +14,10 @@
# don't use postgres
os.environ["ROX_POSTGRES_DATASTORE"] = "false"

versions=["3.71.0", "3.70.0", "3.69.0"]
versions=get_latest_release_versions(4)

gkecluster=GKECluster("qa-e2e-test")

for version in versions:
os.environ["SENSOR_IMAGE_TAG"] = version
make_compatibility_test_runner(cluster=gkecluster).run()

print("stub for version compatibility tests")