diff --git a/app/routes/jobs.py b/app/routes/jobs.py index 23f3421..beb5e4b 100644 --- a/app/routes/jobs.py +++ b/app/routes/jobs.py @@ -17,6 +17,7 @@ LIVE_STATUSES = {"queued", "running", "cancelled_requested"} JOB_STATUSES = {"queued", "running", "cancelled_requested", "cancelled", "success", "failed"} JOB_FILTER_STATUSES = ("queued", "running", "success", "failed", "cancelled") JOB_FILTER_TYPES = ("deploy_app", "deploy_core_service") +IGNORED_RETRY_REPOSITORIES = {"appfactory-tools", "appfactory-infrastructure"} def render_job_status(status: str | None) -> str: @@ -56,6 +57,17 @@ def render_options(values: tuple[str, ...], selected: str, empty_label: str) -> return "".join(options) +def can_retry_job(job: dict) -> bool: + job_type = job.get("type") or "" + target_id = job.get("target_id") or "" + + if job_type == "deploy_core_service": + return True + if job_type == "deploy_app" and target_id not in IGNORED_RETRY_REPOSITORIES: + return True + return False + + @router.get("/jobs", response_class=HTMLResponse) def jobs_page( request: Request, @@ -188,12 +200,15 @@ def job_detail_page(job_id: int, request: Request, user=Depends(require_user)): result = html.escape(pretty_json(job.get("result_json"))) error_text = html.escape(job.get("error_text", "") or "") actions = "" - if status_value == "failed": + retry_blocked_notice = "" + if status_value == "failed" and can_retry_job(job): actions += f"""
""" + elif status_value == "failed" and (job.get("target_id") or "") in IGNORED_RETRY_REPOSITORIES: + retry_blocked_notice = 'Tento repozitář není deployovatelná služba.
' if status_value in {"queued", "running"}: actions += f"""