Skip to content

fix/tekton: updated currency generation #741

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
20 changes: 18 additions & 2 deletions .tekton/.currency/scripts/generate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def is_up_to_date(
return up_to_date, days_behind


def get_taskruns(namespace, task_name, taskrun_filter):
def get_taskruns(namespace, task_name, taskrun_filter, is_default_task=False):
"""Get sorted taskruns filtered based on label_selector"""
group = "tekton.dev"
version = "v1"
Expand All @@ -167,6 +167,20 @@ def get_taskruns(namespace, task_name, taskrun_filter):
key=lambda tr: tr["metadata"]["creationTimestamp"], reverse=True
)

name_pattern = re.compile(r".*-(\d+)$")

if is_default_task:
print(filtered_taskruns)
filtered_taskruns.sort(
key=lambda tr: int(name_pattern.search(tr["metadata"]["name"]).group(1)),
reverse=True,
)
else:
filtered_taskruns.sort(
key=lambda tr: tr["metadata"]["creationTimestamp"],
reverse=True,
)

return filtered_taskruns


Expand Down Expand Up @@ -236,7 +250,9 @@ def get_tekton_ci_output():
lambda tr: tr["metadata"]["name"].endswith("unittest-default-3")
and tr["status"]["conditions"][0]["type"] == "Succeeded"
)
default_taskruns = get_taskruns(namespace, task_name, taskrun_filter)
default_taskruns = get_taskruns(
namespace, task_name, taskrun_filter, is_default_task=True
)

tekton_ci_output = process_taskrun_logs(
default_taskruns, core_v1_client, namespace, task_name, tekton_ci_output
Expand Down
3 changes: 2 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
-r requirements-minimal.txt
aioamqp>=0.15.0
aiofiles>=0.5.0
aiohttp>=3.8.3
aiohttp<=3.10.11; python_version <= "3.8"
aiohttp>=3.10.11; python_version > "3.8"
boto3>=1.17.74
bottle>=0.12.25
celery>=5.2.7
Expand Down
Loading