Skip to content

flux check always returns 0 #5220

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

Open
1 task done
attributeerror opened this issue Feb 27, 2025 · 2 comments · May be fixed by #5267
Open
1 task done

flux check always returns 0 #5220

attributeerror opened this issue Feb 27, 2025 · 2 comments · May be fixed by #5267

Comments

@attributeerror
Copy link

Describe the bug

I am creating a pipeline which automatically updates FluxCD via a pull request. I was running into some permissions issues, in which I found that flux check always returns with an exit code of 0 even if not all deployments were ready:

Image

Note the first arrow points to the result of flux check --pre which is as expected since it says all checks passed. The second arrow points to the result of flux check which should return a non-zero status code since the checks failed.

Steps to reproduce

  1. Install Flux.
  2. Create a ServiceAccount missing some permissions required for flux check to run (reference What RBAC permissions are required for `flux check` to run successfully? #5217 (comment)).
  3. Run flux check.
  4. Run echo $? to see the status code.

Expected behavior

echo $? should return a non-zero status code if the result is "check failed".

Screenshots and recordings

No response

OS / Distro

Ubuntu 22.04

Flux version

v2.5.1

Flux check

► checking prerequisites
✔ Kubernetes 1.31.1 >=1.30.0-0
► checking version in cluster
✔ distribution: flux-v2.4.0
✔ bootstrapped: true
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v1.1.0
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.39.0
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.33.0
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v1.4.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v1.4.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v1.4.1
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta3
✔ buckets.source.toolkit.fluxcd.io/v1
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1
✔ helmreleases.helm.toolkit.fluxcd.io/v2
✔ helmrepositories.source.toolkit.fluxcd.io/v1
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta2
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta2
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta2
✔ 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

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
@h3nryc0ding
Copy link
Contributor

Maybe a duplicate of #5051

@matheuscscp
Copy link
Member

Maybe a duplicate of #5051

Not really, these are two separate bugs.

On this one, to me it seems like we should be returning errors here:

case status.NotFoundStatus:
sc.logger.Failuref("%s: %s not found", rs.Identifier.Name, strings.ToLower(rs.Identifier.GroupKind.Kind))
default:
sc.logger.Failuref("%s: %s not ready", rs.Identifier.Name, strings.ToLower(rs.Identifier.GroupKind.Kind))

@attributeerror @h3nryc0ding Are either of you interested in fixing this bug?

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 a pull request may close this issue.

3 participants