Skip to content

fix(sync-from-upstream): set git safe.directory for values-sync drift detection - #200

Merged
fhielpos merged 1 commit into
mainfrom
fix-values-sync-git-safe-directory
Jun 2, 2026
Merged

fix(sync-from-upstream): set git safe.directory for values-sync drift detection#200
fhielpos merged 1 commit into
mainfrom
fix-values-sync-git-safe-directory

Conversation

@fhielpos

@fhielpos fhielpos commented Jun 2, 2026

Copy link
Copy Markdown
Member

Problem

The Detect upstream values drift step in sync-from-upstream.yaml fails with:

```
Error: computing diff for falco: finding git root for /github/workspace/helm/falco/charts/falco/values.yaml: exit status 128
```

shield-values-sync --show-git-diff shells out to git to diff upstream values against main. The step mounts the workspace into a container running as root (uid 0), while actions/checkout writes the repo as the runner user (uid 1001). Git ≥2.35.2 then refuses every command on the repo with "detected dubious ownership"git rev-parse --show-toplevel exits 128, surfacing as the "finding git root" error.

Because the step is guarded with || true, the job stays green but the drift report is silently lost — so the "Values from upstream chart have drifted" warning never gets posted on update PRs.

Fix

Inject safe.directory=/github/workspace into git via GIT_CONFIG_* env vars on the one docker run that uses --show-git-diff. This is process-scoped (no image rebuild) and only touches the git-using step — Run values-sync and schema-gen don't shell out to git.

Notes

A more durable follow-up would be to bake safe.directory=* into the shield-values-sync image so any future git-using flag is covered without each workflow needing these env vars.

… detection

The values-sync drift step mounts the workspace into a container running
as root, while actions/checkout writes the repo as the runner user. Git
then aborts with 'detected dubious ownership' (exit 128) when computing the
upstream diff, so drift detection silently fails.

Inject safe.directory=/github/workspace via GIT_CONFIG env vars so git
trusts the mounted workspace.
@fhielpos
fhielpos requested a review from a team as a code owner June 2, 2026 16:37
@fhielpos
fhielpos merged commit 8f46dbe into main Jun 2, 2026
1 check passed
@fhielpos
fhielpos deleted the fix-values-sync-git-safe-directory branch June 2, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant