run-pipeline

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Run Pipeline

运行流水线

Execute and monitor Harness pipeline runs via MCP.
通过MCP执行并监控Harness流水线运行。

Instructions

操作说明

Step 1: Find the Pipeline

步骤1:查找流水线

Call MCP tool: harness_search
Parameters:
  query: "<user's pipeline name or keyword>"
  resource_types: ["pipeline"]
  compact: true
Or list all pipelines in a project:
Call MCP tool: harness_list
Parameters:
  resource_type: "pipeline"
  org_id: "<organization>"
  project_id: "<project>"
  search_term: "<optional filter>"
Call MCP tool: harness_search
Parameters:
  query: "<user's pipeline name or keyword>"
  resource_types: ["pipeline"]
  compact: true
或列出项目中的所有流水线:
Call MCP tool: harness_list
Parameters:
  resource_type: "pipeline"
  org_id: "<organization>"
  project_id: "<project>"
  search_term: "<optional filter>"

Step 2: Get Pipeline Details

步骤2:获取流水线详情

Call MCP tool: harness_get
Parameters:
  resource_type: "pipeline"
  resource_id: "<pipeline_identifier>"
  org_id: "<organization>"
  project_id: "<project>"
Extract from response:
  • Required runtime inputs (
    <+input>
    fields)
  • Pipeline variables with types and defaults
  • Stage structure and deployment targets
Call MCP tool: harness_get
Parameters:
  resource_type: "pipeline"
  resource_id: "<pipeline_identifier>"
  org_id: "<organization>"
  project_id: "<project>"
从响应中提取:
  • 必填运行时输入(
    <+input>
    字段)
  • 带类型和默认值的流水线变量
  • 阶段结构和部署目标

Step 3: Check Available Input Sets

步骤3:查看可用输入集

Call MCP tool: harness_list
Parameters:
  resource_type: "input_set"
  org_id: "<organization>"
  project_id: "<project>"
Input sets provide pre-configured values that can be used or overridden.
Call MCP tool: harness_list
Parameters:
  resource_type: "input_set"
  org_id: "<organization>"
  project_id: "<project>"
输入集提供可使用或覆盖的预配置值。

Step 4: Execute the Pipeline

步骤4:执行流水线

Call MCP tool: harness_execute
Parameters:
  resource_type: "pipeline"
  action: "run"
  resource_id: "<pipeline_identifier>"
  org_id: "<organization>"
  project_id: "<project>"
Call MCP tool: harness_execute
Parameters:
  resource_type: "pipeline"
  action: "run"
  resource_id: "<pipeline_identifier>"
  org_id: "<organization>"
  project_id: "<project>"

Step 5: Monitor Execution

步骤5:监控执行状态

Call MCP tool: harness_get
Parameters:
  resource_type: "execution"
  resource_id: "<execution_id>"
  org_id: "<organization>"
  project_id: "<project>"
Execution statuses: Running, Success, Failed, Aborted, Waiting (approval/input), Expired
Call MCP tool: harness_get
Parameters:
  resource_type: "execution"
  resource_id: "<execution_id>"
  org_id: "<organization>"
  project_id: "<project>"
执行状态:Running、Success、Failed、Aborted、Waiting(等待审批/输入)、Expired

Step 6: Handle Approvals

步骤6:处理审批

If execution is waiting for approval:
Call MCP tool: harness_list
Parameters:
  resource_type: "approval_instance"
  org_id: "<organization>"
  project_id: "<project>"
Then approve or reject:
Call MCP tool: harness_execute
Parameters:
  resource_type: "approval_instance"
  action: "approve"  # or "reject"
  resource_id: "<approval_id>"
如果执行处于等待审批状态:
Call MCP tool: harness_list
Parameters:
  resource_type: "approval_instance"
  org_id: "<organization>"
  project_id: "<project>"
然后进行审批或拒绝:
Call MCP tool: harness_execute
Parameters:
  resource_type: "approval_instance"
  action: "approve"  # or "reject"
  resource_id: "<approval_id>"

Safety: Production Deployments

安全注意:生产环境部署

CRITICAL: Before executing pipelines targeting production:
  1. Confirm intent with the user explicitly
  2. Show what will be deployed (version, service, environment)
  3. Check if pipeline has approval gates
  4. Verify the version was tested in lower environments
重要提示:在执行面向生产环境的流水线之前:
  1. 明确与用户确认执行意图
  2. 展示将要部署的内容(版本、服务、环境)
  3. 检查流水线是否有审批关卡
  4. 验证该版本已在低级别环境中完成测试

Response Format

响应格式

Before Execution

执行前

Pipeline: <name>
Project: <project>
Required Inputs: <list variables needing values>
Available Input Sets: <list>
Ready to execute? Confirm to proceed.
Pipeline: <name>
Project: <project>
Required Inputs: <list variables needing values>
Available Input Sets: <list>
Ready to execute? Confirm to proceed.

After Trigger

触发后

Pipeline: <name>
Execution ID: <id>
Status: Running
View in Harness: <openInHarness link>
Pipeline: <name>
Execution ID: <id>
Status: Running
View in Harness: <openInHarness link>

Execution Complete

执行完成

Pipeline: <name>
Status: Success/Failed
Duration: <time>
Stages: <stage results table>
Pipeline: <name>
Status: Success/Failed
Duration: <time>
Stages: <stage results table>

Retrying Failed Executions

重试失败的执行

Retry is an action on
pipeline
(not
execution
). Pass the pipeline ID as
resource_id
and the failed execution's ID as
execution_id
:
Call MCP tool: harness_execute
Parameters:
  resource_type: "pipeline"
  action: "retry"
  resource_id: "<pipeline_id>"
  execution_id: "<execution_id>"
  org_id: "<organization>"
  project_id: "<project>"
重试是针对
pipeline
的操作(而非
execution
)。将流水线ID作为
resource_id
传入,失败执行的ID作为
execution_id
传入:
Call MCP tool: harness_execute
Parameters:
  resource_type: "pipeline"
  action: "retry"
  resource_id: "<pipeline_id>"
  execution_id: "<execution_id>"
  org_id: "<organization>"
  project_id: "<project>"

Interrupting Running Executions

中断运行中的执行

To abort an entire pipeline execution:
Call MCP tool: harness_execute
Parameters:
  resource_type: "execution"
  action: "interrupt"
  resource_id: "<execution_id>"
  org_id: "<organization>"
  project_id: "<project>"
  params:
    interrupt_type: "AbortAll"
The
interrupt_type
field inside
params
is required. Valid values:
interrupt_typeEffect
AbortAll
Abort the entire pipeline execution
UserMarkedFailure
Mark the execution as failed by user
To abort multiple stuck executions, call
harness_execute
with
params: {interrupt_type: "AbortAll"}
for each execution ID.
要中止整个流水线执行:
Call MCP tool: harness_execute
Parameters:
  resource_type: "execution"
  action: "interrupt"
  resource_id: "<execution_id>"
  org_id: "<organization>"
  project_id: "<project>"
  params:
    interrupt_type: "AbortAll"
params
中的
interrupt_type
字段为必填项。有效值:
interrupt_type作用
AbortAll
中止整个流水线执行
UserMarkedFailure
将执行标记为用户手动失败
要中止多个卡住的执行,需为每个执行ID调用
harness_execute
并传入
params: {interrupt_type: "AbortAll"}

Examples

示例

  • "Run the ci-pipeline" - Search for pipeline, execute with defaults
  • "Deploy version 2.0.0 to staging" - Find deploy pipeline, provide version input, execute
  • "What's the status of execution xyz123?" - Get execution details
  • "Retry the last failed deployment" - List recent failed executions, retry
  • "Abort all stuck executions" - List running/waiting executions, interrupt each with
    params: {interrupt_type: "AbortAll"}
  • "Stop execution abc123" - Interrupt the specific execution with
    params: {interrupt_type: "AbortAll"}
  • "Run the ci-pipeline" - 搜索流水线,使用默认值执行
  • "Deploy version 2.0.0 to staging" - 查找部署流水线,提供版本输入,执行
  • "What's the status of execution xyz123?" - 获取执行详情
  • "Retry the last failed deployment" - 列出近期失败的执行,进行重试
  • "Abort all stuck executions" - 列出运行中/等待中的执行,逐个调用
    params: {interrupt_type: "AbortAll"}
    进行中断
  • "Stop execution abc123" - 使用
    params: {interrupt_type: "AbortAll"}
    中断指定执行

Performance Notes

性能注意事项

  • Always confirm the pipeline identifier and required inputs before triggering execution. A failed execution due to missing inputs wastes time.
  • When monitoring executions, wait for terminal status (Success, Failed, Aborted) before reporting results. Do not assume intermediate states are final.
  • If an execution fails, gather full error context from logs before suggesting fixes. Do not guess at root causes.
  • 触发执行前,务必确认流水线标识符和必填输入项。因缺少输入导致的执行失败会浪费时间。
  • 监控执行状态时,需等待终端状态(Success、Failed、Aborted)后再报告结果。请勿假设中间状态为最终状态。
  • 如果执行失败,需从日志中收集完整的错误上下文后再建议修复方案。请勿猜测根本原因。

Troubleshooting

故障排除

Pipeline Won't Start

流水线无法启动

  • Check delegate availability with
    harness_status
  • Validate all required inputs have values
  • Test connector credentials with
    harness_execute
    (resource_type: "connector", action: "test_connection")
  • 使用
    harness_status
    检查代理可用性
  • 验证所有必填输入项均已赋值
  • 使用
    harness_execute
    测试连接器凭据(resource_type: "connector", action: "test_connection")

Missing Inputs

缺少输入项

  • Use
    harness_get
    on the pipeline to see all
    <+input>
    fields
  • Check input sets for pre-configured values
  • 对流水线调用
    harness_get
    查看所有
    <+input>
    字段
  • 检查输入集获取预配置值

Execution Stuck

执行卡住

  • Check for pending approvals with
    harness_list
    (resource_type: "approval_instance")
  • Check delegate status with
    harness_status
  • Abort stuck executions with
    harness_execute
    (resource_type: "execution", action: "interrupt", params: {interrupt_type: "AbortAll"})
  • 使用
    harness_list
    检查待处理审批(resource_type: "approval_instance")
  • 使用
    harness_status
    检查代理状态
  • 使用
    harness_execute
    中止卡住的执行(resource_type: "execution", action: "interrupt", params: {interrupt_type: "AbortAll"})