Skip to content

fix(repo-server-api): stage the whole branch folder for kustomize sources with refs - #474

Merged
dag-andersen merged 1 commit into
dag-andersen:mainfrom
mickaelicoptere:up/kustomize-source-staging
Aug 23, 2026
Merged

dag-andersen merged 1 commit into
dag-andersen:mainfrom
mickaelicoptere:up/kustomize-source-staging

Conversation

@mickaelicoptere

@mickaelicoptere mickaelicoptere commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Why

Our apps are kustomize overlays referencing shared bases outside their own directory (resources: ../../base/...), built with --load-restrictor LoadRestrictionsNone. When an app also has ref sources ($values files), the tool stages only the source dir + .refs/, so every one of those apps fails with no such file or directory.

Fix

Stage the whole checkout for kustomize sources — like the no-refs fast path already does, and like Argo CD itself: the repo server always runs kustomize inside a full clone, and kustomize allows directory references anywhere in the repo even with default load restrictions (only file loads are restricted).

The new stageCheckout keeps that cheap and faithful:

  • files are hardlinked (staging is read-only; byte-copy fallback)
  • symlinks stay symlinks — the tar transport preserves them, and the repo server + kustomize already validate them, so everything behaves like on a real clone
  • .git is skipped

copyDir (chart/ref staging) is unchanged. Tests cover the escaping reference and the staging semantics. Validated on a >1000-app monorepo: 6 failing apps → 0.

…with refs

Kustomize apps referencing files outside their source dir (resources:
../../base/...) fail with 'no such file or directory' when ref sources
are present, because only the source dir + .refs/ get staged. Stage the
whole checkout instead, like the no-refs fast path and like the repo
server does with a real clone.
Files are hardlinked, symlinks stay symlinks (the repo server and kustomize validate them), .git is skipped.
@mickaelicoptere
mickaelicoptere force-pushed the up/kustomize-source-staging branch from b7e798e to ae8a381 Compare August 19, 2026 21:50

@dag-andersen dag-andersen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for this bugfix!

@dag-andersen
dag-andersen merged commit 559f774 into dag-andersen:main Aug 23, 2026
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.

2 participants