Skip to content

Commit 1f90d94

Browse files
authored
Fix v0 abort deleting v1alpha testrun Jobs (eiffel-community#143)
1 parent 82dad75 commit 1f90d94

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

python/src/etos_api/routers/v0/router.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ async def _start(etos: StartEtosRequest, span: Span, ctx: otel_context.Context)
220220

221221

222222
async def _abort(suite_id: str) -> dict:
223-
"""Abort an ETOS test suite execution."""
223+
"""Abort an ETOS v0 test suite execution."""
224224
kubernetes = Kubernetes()
225225

226226
batch_api = client.BatchV1Api()
@@ -229,23 +229,11 @@ async def _abort(suite_id: str) -> dict:
229229
delete_options = client.V1DeleteOptions(
230230
propagation_policy="Background" # asynchronous cascading deletion
231231
)
232-
# trying different labels for backwards compatibility:
233-
# - namespaced labels: ETOS v1alpha+
234-
# - app/id: ETOS v0 legacy
235-
label_pairs = (
236-
("app.kubernetes.io/name", "etos.eiffel-community.github.io/id"),
237-
("app", "id"),
238-
)
239232
for job in jobs.items:
240-
job_found = False
241-
for app_label, id_label in label_pairs:
242-
if (
243-
job.metadata.labels.get(app_label) == "suite-runner"
244-
and job.metadata.labels.get(id_label) == suite_id
245-
):
246-
job_found = True
247-
break
248-
if job_found:
233+
if (
234+
job.metadata.labels.get("app") == "suite-runner"
235+
and job.metadata.labels.get("id") == suite_id
236+
):
249237
batch_api.delete_namespaced_job(
250238
name=job.metadata.name, namespace=kubernetes.namespace, body=delete_options
251239
)

0 commit comments

Comments
 (0)