Skip to content

fix(piped): clean up cloned repo after skip stage check#7021

Open
Ahmad-Faraj wants to merge 1 commit into
pipe-cd:masterfrom
Ahmad-Faraj:fix/skipstage-clean-worktree
Open

fix(piped): clean up cloned repo after skip stage check#7021
Ahmad-Faraj wants to merge 1 commit into
pipe-cd:masterfrom
Ahmad-Faraj:fix/skipstage-clean-worktree

Conversation

@Ahmad-Faraj

@Ahmad-Faraj Ahmad-Faraj commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What this PR does:

shouldSkipStage clones the repo into a temporary directory on every skip check but never removes it. Each check with skipOn conditions leaks one temp directory until the piped restarts. This adds a deferred repo.Clean(), the same pattern the drift detectors and the event watcher use.

Which issue(s) this PR fixes:

None

Does this PR introduce a user-facing change?:

  • How are users affected by this change: none
  • Is this breaking change: no
  • How to migrate (if breaking change): n/a

Signed-off-by: Ahmad Faraj <ahmedfrag4040@gmail.com>
Copilot AI review requested due to automatic review settings July 12, 2026 16:09
@Ahmad-Faraj
Ahmad-Faraj requested a review from a team as a code owner July 12, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a resource leak in the legacy piped controller by ensuring the temporary git worktree created during shouldSkipStage is cleaned up after each skip check, preventing accumulation of leftover clone directories over time.

Changes:

  • Add a deferred cleanup (repo.Clean()) after successfully cloning the repository in shouldSkipStage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants