pipedv1: deployment remains stuck in PENDING when deploy source preparation fails in planner

未关闭 适合新手
#7,641 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@vikash7485 已经在做这个了。

开始于 2026年11月18日。

  • #7649 来自 @vikash7485 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
80/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
backend, ci-cd

调研方向

从 pkg/app/pipedv1/controller/planner.go 中的 planner.Run()(第 206-226 行)开始:targetDSP.Get 和 runningDSP.Get 都会提前返回,而不会更新 doneDeploymentStatus。比较第 242 行附近的 buildPlan 失败分支,该分支会设置 DeploymentStatus_DEPLOYMENT_FAILURE 并调用 reportDeploymentFailed。让源获取错误路径也做同样的事,然后检查 controller.go 中的 syncPlanners 会清除 Deploying;为失败的 Get 添加一个测试。当失败的源准备报告部署失败而不是停留在 PENDING 时完成。

由索引模型根据 Issue 内容生成。

描述

What happened:

In pipedv1, when a deployment is triggered, c.startNewPlanner() launches the planner goroutine. Inside planner.Run() (pkg/app/pipedv1/controller/planner.go:206-226), target and running deploy sources are fetched via targetDSP.Get(ctx, io.Discard) and runningDSP.Get(ctx, io.Discard).

If either Get() call fails (for example due to a git clone/fetch error, missing remote commit hash, git auth failure, or secret decryption error):

  1. Run() immediately returns err.
  2. p.doneDeploymentStatus remains at its uninitialized zero value DEPLOYMENT_PENDING.
  3. In controller.go:462, c.wg.Go only logs the error:
    if err := planner.Run(ctx); err != nil {
        logger.Error("failed to run planner", zap.Error(err))
    }
    
  4. p.reportDeploymentFailed(ctx, ...) is never called.
  5. In c.syncPlanners() (controller.go:275), p.DoneDeploymentStatus().IsCompleted() evaluates to false because status is DEPLOYMENT_PENDING. Consequently, reportApplicationDeployingStatus(ctx, c.apiClient, id, false) is never called, leaving the application permanently marked as Deploying: true.
  6. Furthermore, after plannerStaleDuration passes, c.donePlanners evicts the deployment ID, and c.deploymentLister.ListPendings() re-selects the deployment, causing the planner to repeatedly loop and fail on every sync interval.

In contrast, when buildPlan fails on line 242, it correctly reports the failure:

if err != nil {
    p.doneDeploymentStatus = model.DeploymentStatus_DEPLOYMENT_FAILURE
    return p.reportDeploymentFailed(ctx, fmt.Sprintf("Unable to plan the deployment (%v)", err))
}

What you expected to happen:

When deploy source retrieval fails, planner.Run() should set p.doneDeploymentStatus = model.DeploymentStatus_DEPLOYMENT_FAILURE and invoke p.reportDeploymentFailed(ctx, ...) so that the control plane records the deployment failure, alerts/notifications fire, and the application is cleared from deploying state.

How to reproduce it:

  1. Trigger a deployment in pipedv1 pointing to a commit hash or branch that does not exist on the remote git repository (or simulate a git authentication / decryption failure).
  2. Check piped logs: error while preparing target deploy source data followed by failed to run planner.
  3. Check the deployment on the control plane / web UI: the deployment remains perpetually in PENDING state and the application remains marked as deploying.

Environment:

  • piped version: master (commit 5dc13c2), pipedv1
  • control-plane version: master
  • Others: N/A
主要语言
Go
星标
1.4k
派生
403
平均合并
2 天 9 小时
30 天内合并 PR
40

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pipe-cd/pipecd 的其他 Issue

查看 pipe-cd/pipecd 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。