Skip to content

flux check always returns 0 #5220

@attributeerror

Description

@attributeerror

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions