Skip to content
Snippets Groups Projects

A collection MR of minor tweaks that I notice while developing but are out-of-scope

Merged Luke Grazette requested to merge lugrazet-minor-tweaks into main
6 files
+ 3
192
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 2
64
@@ -60,67 +60,6 @@ def id(specs: list[str], tck_tags: list[str]):
return 0
def prconfig_version(tags: list[str], specs: list[str]):
"""
Checks that the prconfig is the latest version, flags if not, per tck.
"""
ret = 0
messages = []
__log = lambda msg: helper.log_friendly_message(messages=messages, msg=msg)
ref_yaml_fp = specs[0]
ref_tck_spec = helper.yaml_parser(ref_yaml_fp)
ref_tck_tag = ref_tck_spec['parameters']['PRConfig']
if ref_tck_tag not in tags:
__log(
f"ERROR: PRConfig tag {ref_tck_tag} is not a valid relase. Check configuration"
)
ret += 1
decomposed_tck_tag = helper.decompose_tag(ref_tck_tag)
print(f"decomposed_tck_tag: {decomposed_tck_tag}")
decomposed_tags = {tag: helper.decompose_tag(tag) for tag in tags}
print(f"decomposed_tags:\n{decomposed_tags}")
latest_v = sorted([decomp[0] for decomp in decomposed_tags.values()],
reverse=True)[0]
latest_r = sorted([
decomp[1]
for decomp in decomposed_tags.values() if decomp[0] == (latest_v)
],
reverse=True)[0]
latest_p = sorted([
decomp[2] for decomp in decomposed_tags.values()
if (decomp[0] == latest_v and decomp[1] == latest_r)
],
reverse=False)[0]
decomposed_latest_tag = (latest_v, latest_r, latest_p)
print(f"decomposed_latest_tag: {decomposed_latest_tag}")
latest_tag = f"v{latest_v}r{latest_r}p{latest_p}" if latest_p > 0 else f"v{latest_v}r{latest_r}"
if decomposed_tck_tag != decomposed_latest_tag:
__log(
f"WARNING: PRConfig tag {ref_tck_tag} is not the latest version {latest_tag}. Are you sure?"
)
ret += 1
else:
__log(f"PRConfig tag {ref_tck_tag} is the latest version.")
# repeat the printing at the bottom of the log for ease of reading.
print("\nSTARTING SUMMARY OF JOB")
print("------------------------------------------------------------------")
for msg in messages:
print(msg)
print("------------------------------------------------------------------")
if ret != 0:
raise RuntimeError(
f"WARNING:: Some PRConfig tags are not most recent version {ret}. Check logs.\n"
)
else:
print("SUCCESS:: PRC tag check completed successfully.")
print("FINISHED SUMMARY OF JOB\n")
def workflow_and_settings(specs: list[str]):
"""
Checks the following for every specification:
@@ -149,8 +88,7 @@ def workflow_and_settings(specs: list[str]):
isParameter=isParameter,
log=__log)
for key, isParameter in zip(['stack', 'PRConfig', 'workflow'],
[True, True, False]):
for key, isParameter in zip(['stack', 'workflow'], [True, False]):
ret += __compare(key=key, isParameter=isParameter)
if ref_tck_spec['workflow'] == helper.COMMIT_BASED_WORKFLOW:
@@ -158,7 +96,7 @@ def workflow_and_settings(specs: list[str]):
if ret > 0:
raise RuntimeError(
"FAILURE::TCK specifications within a single MR need to share the same project Stack/Workflow/Commits/PRConfig_version. Check configuration"
"FAILURE::TCK specifications within a single MR need to share the same project Stack/Workflow/Commits. Check configuration"
)
# Now that we know they share the same configuration, we only need to do this for the first specification.
Loading