pipe-cd / pipecd

The One CD for All {applications, platforms, operations}
https://pipecd.dev
Apache License 2.0
1.09k stars 153 forks source link

Execute git clean partially when drift detection for every app is done #5312

Closed ffjlabo closed 1 week ago

ffjlabo commented 1 week ago

What this PR does:

Fixed to execute git clean -f for every app dir after doing k8s drift detection.

Why we need it:

During drift detection, a Git repository is cloned and reused, and a common manifest cache is utilized for various operations like drift detection, plan preview, plan, and deploy. If an incorrect manifest is cached, it can affect other processes. When running kustomize build --enable-helm, a charts directory is created, and the Helm chart is downloaded locally. However, before kustomize v5.3.0, this directory is not updated if the Helm chart version in kustomization.yaml changes, causing drift detection to load outdated manifests. These manifests are cached based on commit hash, leading to incorrect manifests being applied during Plan or Deploy if the same commit hash is used.

For the context, see https://github.com/pipe-cd/pipecd/issues/5124#issuecomment-2277628373

Which issue(s) this PR fixes:

Fixes #5124

Does this PR introduce a user-facing change?:

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 23.07692% with 20 lines in your changes missing coverage. Please review.

Project coverage is 25.26%. Comparing base (6b43655) to head (f1ef1a9). Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
pkg/app/piped/driftdetector/kubernetes/detector.go 0.00% 12 Missing :warning:
pkg/git/gittest/git.mock.go 0.00% 8 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5312 +/- ## ========================================== - Coverage 25.27% 25.26% -0.01% ========================================== Files 444 444 Lines 47516 47554 +38 ========================================== + Hits 12010 12016 +6 - Misses 34563 34596 +33 + Partials 943 942 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ffjlabo commented 1 week ago

@Warashi Sorry, plz re-approve 🙏