AgentSkillsCN

cancel-pipeline

取消正在运行或卡住的 Tekton 管道。适用于管道卡滞、启动了错误的构建、需要释放集群资源,或希望以不同参数重新尝试时使用。

SKILL.md
--- frontmatter
name: cancel-pipeline
description: Cancel a running or stuck Tekton pipeline. Use when pipeline is stuck, wrong build started, need to free cluster resources, or want to retry with different parameters.

Cancel Pipeline

Cancel running or stuck Tekton (Konflux) pipelines. Also supports GitLab CI cancellation.

Inputs

InputTypeDefaultPurpose
run_namestring-PipelineRun name (lists running if not specified)
namespacestringaap-aa-tenantKonflux/Tekton namespace
deleteboolfalseDelete PipelineRun after cancelling
list_onlyboolfalseJust list running pipelines
pipeline_idint-GitLab CI pipeline ID (for GitLab)
projectstringautomation-analytics/automation-analytics-backendGitLab project

Workflow

1. Load Persona

  • persona_load("release") — for Tekton tools

2. GitLab Path (if pipeline_id)

  • gitlab_ci_cancel(project="{{ project }}", pipeline_id="{{ pipeline_id }}")

3. Tekton Path

  • tkn_pipelinerun_list(namespace="{{ namespace }}", limit=20)
  • Parse for running pipelines
  • If run_name not specified and only one running: use it
  • If multiple: ask user to specify

4. Get Details (if not list_only)

  • tkn_pipelinerun_describe(run_name="{{ target_run }}", namespace="{{ namespace }}")
  • Verify status is "running" before cancel

5. Cancel

  • tkn_pipelinerun_cancel(run_name="{{ target_run }}", namespace="{{ namespace }}")

6. Delete (if delete=true)

  • tkn_pipelinerun_delete(run_name="{{ target_run }}", namespace="{{ namespace }}")

7. Error Recovery

  • "no route to host" → vpn_connect(), kube_login("konflux")
  • "unauthorized" → kube_login("konflux")
  • "pipelinerun not found" → already completed; list with tkn_pipelinerun_list()

8. Memory

  • memory_session_log("Cancelled pipeline", "{{ run_name }}, namespace={{ namespace }}")

Output

Report: running pipelines list, target run, cancel status, delete status (if applicable), and retry commands (tkn_pipeline_start).