pipe-cd / pipe-cd/pipecd

Deployment fails when the application git branch is changed

Open
#4,618 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/piped kind/enhancement not-auto-close
Dominant language
Go
Stars
1.4k
Forks
364
Avg merge
1d 4h
Merged PRs (30d)
84

Description

What happened:

Deployment fails when the application git branch is changed.

What you expected to happen:

No failure

How to reproduce it:

  1. branch: launch PipeCD Agent for v2
  2. ADD the application
  3. Modify PipeCD Agent configuration (branch: main)
  4. Verify that changes in main branch can be deployed
  5. Delete branch: v2
  6. The change in main branch is detected and deployed successfully
  7. Restart PipeCD Agent
  8. Main branch changes are detected, but deploy fails

Environment:

  • piped version:
  • control-plane version:
  • Others:
jsonPayload: {
branch: "v2"
caller: "git/client.go:191"
error: "exit status 128"
eventTime: 1697503936.6423886
logger: "piped.piped"
message: "failed to clone from local"
out: "Cloning into '/tmp/workspace4070547661/fbd286cb-20ee-4c7b-8920-69663c42f6bd-planner-1664305497/target-deploysource/deploysource2595605295/repo'...
fatal: Remote branch v2 not found in upstream origin
"
remote: "git@github.com:kentakozuka/pipecd-play.git"
repo-id: "pipecd-play"
repo-path: "/tmp/workspace4070547661/fbd286cb-20ee-4c7b-8920-69663c42f6bd-planner-1664305497/target-deploysource/deploysource2595605295/repo"
serviceContext: {2}
stacktrace: "github.com/pipe-cd/pipecd/pkg/git.(*client).Clone
	/home/runner/work/pipecd/pipecd/pkg/git/client.go:191
github.com/pipe-cd/pipecd/pkg/app/piped/deploysource.(*gitSourceCloner).Clone
	/home/runner/work/pipecd/pipecd/pkg/app/piped/deploysource/sourcecloner.go:59
github.com/pipe-cd/pipecd/pkg/app/piped/deploysource.(*provider).prepare
	/home/runner/work/pipecd/pipecd/pkg/app/piped/deploysource/deploysource.go:146
github.com/pipe-cd/pipecd/pkg/app/piped/deploysource.(*provider).Get
	/home/runner/work/pipecd/pipecd/pkg/app/piped/deploysource/deploysource.go:92
github.com/pipe-cd/pipecd/pkg/app/piped/planner/kubernetes.(*Planner).Plan
	/home/runner/work/pipecd/pipecd/pkg/app/piped/planner/kubernetes/kubernetes.go:56
github.com/pipe-cd/pipecd/pkg/app/piped/controller.(*planner).Run
	/home/runner/work/pipecd/pipecd/pkg/app/piped/controller/planner.go:202
github.com/pipe-cd/pipecd/pkg/app/piped/controller.(*controller).startNewPlanner.func2
	/home/runner/work/pipecd/pipecd/pkg/app/piped/controller/controller.go:499"
}
labels: {4}
logName: "projects/pipecd/logs/stderr"
receiveTimestamp: "2023-10-17T00:52:21.597267065Z"
resource: {2}
severity: "ERROR"
timestamp: "2023-10-17T00:52:16.653773215Z"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failed clone in pkg/git/client.go:191 and trace the deploy-source flow through pkg/app/piped/deploysource/sourcecloner.go and deploysource.go. Reproduce the branch change and agent restart described in the issue, then verify that changes from the new branch are detected and deployed successfully without requesting the deleted branch.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, go
Domain
backend, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.