Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flux commands panic when $HOME $XDG_CONFIG_HOME unset #4961

Closed
1 task done
hillsprig opened this issue Aug 30, 2024 · 2 comments · Fixed by #4970
Closed
1 task done

flux commands panic when $HOME $XDG_CONFIG_HOME unset #4961

hillsprig opened this issue Aug 30, 2024 · 2 comments · Fixed by #4970

Comments

@hillsprig
Copy link

hillsprig commented Aug 30, 2024

Describe the bug

I'm running a couple of flux commands in daemon scripts to check and do various operations towards my edge cluster.

In Flux 2.2.3 this worked fine. In Flux 2.3.0 we get a panic unless either $HOME or $XDG_CONFIG_HOME is set.

Steps to reproduce

% env -u HOME -u XDG_CONFIG_HOME ./flux_2.3.0_linux_amd64 check

panic: neither $XDG_CONFIG_HOME nor $HOME are defined

goroutine 1 [running]:
github.com/notaryproject/notation-go/dir.loadUserPath()
/home/runner/go/pkg/mod/github.com/notaryproject/notation-go@v1.1.0/dir/path.go:85 +0xc5
github.com/notaryproject/notation-go/dir.init.0()
/home/runner/go/pkg/mod/github.com/notaryproject/notation-go@v1.1.0/dir/path.go:77 +0xf

Expected behavior

% env -u HOME -u XDG_CONFIG_HOME ./flux_2.2.3_linux_amd64 check

► checking prerequisites
✗ flux 2.2.3 <2.3.0 (new CLI version is available, please upgrade)
✔ Kubernetes 1.30.4+k3s1 >=1.26.0-0
► checking version in cluster
✔ distribution: flux-v0.0.0-dev.0
✔ bootstrapped: false
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v1.0.1
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v1.3.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v1.3.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v1.3.0
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta3
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1
✔ helmreleases.helm.toolkit.fluxcd.io/v2
✔ helmrepositories.source.toolkit.fluxcd.io/v1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta3
✔ receivers.notification.toolkit.fluxcd.io/v1
✔ all checks passed

Screenshots and recordings

No response

OS / Distro

Arch Linux, Debian Bookworm

Flux version

v2.3.0

Flux check

N/A

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@stefanprodan
Copy link
Member

We've added validation for notation polices in #4735 which imports the notation-go that has a init function which panics here: https://github.com/notaryproject/notation-go/blob/974c2916fa135b977b02db1714efb6ed2ecec0f3/dir/path.go#L82-L97 It's sad to see an SDK that does this on init, it's a major anti-pattern in Go to have init functions in packages... I see no way around this but to drop the notation dependency from Flux by removing the validation code.

cc @JasonTheDeveloper @darkowlzz

@JasonTheDeveloper
Copy link
Contributor

@stefanprodan thank you for letting me know. I'll raise it with the notation team and see if we can push an update through asap. I'll double check there's no other init funcs that panic while I'm at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants