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

オープン 初心者向け
#7,641 コメント 1 件 リアクション 0 件 担当者 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時間
マージ済み PR(30日)
40

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pipe-cd/pipecd のほかの issue

pipe-cd/pipecd の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。