Skip to content

Commit 7d63065

Browse files
committed
fix(currency): Successful taskrun filter condition
Signed-off-by: Varsha GS <varsha.gs@ibm.com>
1 parent 770b298 commit 7d63065

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.tekton/.currency/scripts/generate_report.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,13 @@ def is_up_to_date(
141141

142142
return up_to_date, days_behind
143143

144-
145-
def get_taskruns(namespace, task_name, taskrun_filter):
144+
def taskrun_filter(taskrun):
145+
return any(
146+
condition["type"] == "Succeeded" and condition["status"] == "True"
147+
for condition in taskrun["status"]["conditions"]
148+
)
149+
150+
def get_taskruns(namespace, task_name):
146151
"""Get sorted taskruns filtered based on label_selector"""
147152
group = "tekton.dev"
148153
version = "v1"
@@ -213,8 +218,6 @@ def get_tekton_ci_output():
213218
namespace = "default"
214219
core_v1_client = client.CoreV1Api()
215220

216-
taskrun_filter = lambda tr: tr["status"]["conditions"][0]["type"] == "Succeeded" # noqa: E731
217-
218221
tasks = [
219222
"python-tracer-unittest-gevent-starlette-task",
220223
"python-tracer-unittest-kafka-task",
@@ -226,7 +229,7 @@ def get_tekton_ci_output():
226229

227230
for task_name in tasks:
228231
try:
229-
taskruns = get_taskruns(namespace, task_name, taskrun_filter)
232+
taskruns = get_taskruns(namespace, task_name)
230233

231234
tekton_ci_output = process_taskrun_logs(
232235
taskruns, core_v1_client, namespace, task_name, tekton_ci_output

0 commit comments

Comments
 (0)