allenporter/flux-local

flux-local failures: FileNotFoundError: [Errno 2] No such file or directory

allenporter opened this issue · 9 comments

Example run:
https://github.com/onedr0p/home-ops/actions/runs/5595213825/jobs/10230874135

Many users reporting failures, like:

INFO:flux_local.git_repo:Unknown cluster source for OCIRepository flux: ./
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.12/x64/bin/flux-local", line 8, in <module>
    sys.exit(main())
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/tool/flux_local.py", line 60, in main
    asyncio.run(action.run(**vars(args)))
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/tool/diff.py", line 337, in run
    await git_repo.build_manifest(
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/git_repo.py", line 580, in build_manifest
    clusters = await get_clusters(
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/git_repo.py", line 470, in get_clusters
    finished = await asyncio.gather(*tasks)
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/git_repo.py", line 375, in kustomization_traversal
    docs = await get_fluxtomizations(root_path_selector.root, path, build=build)
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/git_repo.py", line 326, in get_fluxtomizations
    docs = await cmd.objects()
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/kustomize.py", line 124, in objects
    return [doc async for doc in self._docs()]
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/kustomize.py", line 124, in <listcomp>
    return [doc async for doc in self._docs()]
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/kustomize.py", line 118, in _docs
    out = await self.run()
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/kustomize.py", line 114, in run
    return await run_piped(self._cmds)
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/command.py", line 104, in run_piped
    result = await _run_piped_with_sem(cmds)
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/command.py", line 96, in _run_piped_with_sem
    out = await asyncio.wait_for(cmd.run(stdin), _TIMEOUT)
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
    return fut.result()
  File "/home/runner/work/_actions/allenporter/flux-local/main/flux_local/command.py", line 69, in run
    proc = await asyncio.create_subprocess_shell(
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/subprocess.py", line 205, in create_subprocess_shell
    transport, protocol = await loop.subprocess_shell(
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/base_events.py", line 1648, in subprocess_shell
    transport = await self._make_subprocess_transport(
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/unix_events.py", line 207, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/unix_events.py", line 799, in _start
    self._proc = subprocess.Popen(
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: PosixPath('/home/runner/work/home-ops/home-ops/pr/deploy/controller')
Error: Process completed with exit code 1.
Error: Unable to process file command 'output' successfully.
Error: Invalid value. Matching delimiter not found '8b103dc866634c7a'

Last successful run: https://github.com/onedr0p/home-ops/actions/runs/5593429647/jobs/10227065727

In the first repo, seems like the problem is attempting to build this:

---
# yaml-language-server: $schema=https://kubernetes-schemas.devbu.io/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: cluster-apps-csi-addons-controller-manager
  namespace: flux-system
spec:
  path: ./deploy/controller
  prune: true
  sourceRef:
    kind: GitRepository
    name: kubernetes-csi-addons
  wait: false
  interval: 30m
  retryInterval: 1m
  timeout: 5m

onedr0p and buroa both deployed the same csi controller around the same time (with direct commit, not a PR). 0dragosh's repo is failing for a different release, coincidentally (the path looks incorrect)

3.1.0 has been tagged for release which adds functionlity to --sources to restrict to just the right GitRepository.

szinn commented

szinn/k8s-homelab#2135

I’m getting this error as well and likely have the same csi controller. Adding the sources: line and will see how that does it

szinn/k8s-homelab#2135

I’m getting this error as well and likely have the same csi controller. Adding the sources: line and will see how that does it

As a fox, you can now specify 'sources' with the name of your flux GitRepository or OCIRepository. On mobile but let me know if that fixes it for you or not.

szinn commented

That appears to work fine -

Ok great. For context, the default behavior is to pull in all kustomizations and assume they point to the local repo. Now with sources you select which kustomizations from a specific source repository to include.

Closing since we now have --sources to limit GitRepository and OCIRepository objects to just those that are within cluster. #360 discusses some ideas for pulling remote repos, which may or may not happen.