allenporter / flux-local

flux-local is a set of tools and libraries for managing a local flux gitops repository focused on validation steps to help improve quality of commits, PRs, and general local testing.

Home Page:https://allenporter.github.io/flux-local/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running with relative path outside of git repo fails

allenporter opened this issue · comments

https://github.com/onedr0p/home-ops/actions/runs/7304107954/job/19905782487?pr=6596

Given a rep at /github/workspace/pull/ running the following command from /github/workspace will fail

$ flux-local --log-level DEBUG diff kustomization --unified 6 --path-orig default/kubernetes/main --path pull/kubernetes/main --strip-attrs "helm.sh/chart,checksum/config,app.kubernetes.io/version,chart" --limit-bytes 10000 --all-namespaces --sources "home-kubernetes" --output-file diff.patch
...
FileNotFoundError: [Errno 2] No such file or directory: PosixPath('/github/workspace/pull/pull/kubernetes/main')

This is likely because of the relative path logic here

def relative_path(self) -> Path:
which does not rewrite a relative path to be relative within the git root.

Workarounds are:

  • run from within the repo directory
  • run with absolute paths