fix(sync-from-upstream): set git safe.directory for values-sync drift detection - #200
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Detect upstream values driftstep insync-from-upstream.yamlfails 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-diffshells out to git to diff upstream values againstmain. The step mounts the workspace into a container running as root (uid 0), whileactions/checkoutwrites 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-toplevelexits 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/workspaceinto git viaGIT_CONFIG_*env vars on the onedocker runthat uses--show-git-diff. This is process-scoped (no image rebuild) and only touches the git-using step —Run values-syncandschema-gendon't shell out to git.Notes
A more durable follow-up would be to bake
safe.directory=*into theshield-values-syncimage so any future git-using flag is covered without each workflow needing these env vars.