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

Improve "flux resume" error message on non-existent object #5146

Merged

Conversation

sjorsholtrop-ritense
Copy link
Contributor

Currently, doing a resume operation on non-existent objects, e.g.

flux resume helmrelease foo bar baz

results in the error:

✗ no HelmRelease objects found in flux-system namespace
✗ no HelmRelease objects found in flux-system namespace
✗ no HelmRelease objects found in flux-system namespace

This message could be more helpful. Additionally, when resuming only a single resource, the error message is slightly misleading as there might exist HelmRelease objects, just not the ones your provided.

With this PR, the output would become:

✗ HelmRelease object 'foo' not found in flux-system namespace
✗ HelmRelease object 'bar' not found in flux-system namespace
✗ HelmRelease object 'baz' not found in flux-system namespace

This error message is more descriptive and follows the same format as the one in cmd/flux/get.go:187.

@matheuscscp
Copy link
Member

@sjorsholtrop-ritense Please sign the commit with git commit -s so I can approve the workflows to run

@sjorsholtrop-ritense
Copy link
Contributor Author

@sjorsholtrop-ritense Please sign the commit with git commit -s so I can approve the workflows to run

Done!

@matheuscscp
Copy link
Member

@sjorsholtrop-ritense

=== RUN   TestHelmReleaseFromGit
    main_test.go:356: Mismatch from golden file 'testdata/helmrelease/resume_helmrelease_from_git.golden': Mismatch from expected value (-want +got):
          (
          	"""
        - 	► resuming helmrelease thrfg in thrfg-1 namespace
        - 	✔ helmrelease resumed
        - 	◎ waiting for HelmRelease reconciliation
        - 	✔ HelmRelease thrfg reconciliation completed
        - 	✔ applied revision 6.3.5
        + 	✗ HelmRelease object 'thrfg' not found in thrfg-1 namespace
          	"""
          )

Signed-off-by: Sjors Holtrop <[email protected]>
@matheuscscp
Copy link
Member

@sjorsholtrop-ritense the file from the diff I posted above is testdata/helmrelease/resume_helmrelease_from_git.golden

@sjorsholtrop-ritense
Copy link
Contributor Author

@sjorsholtrop-ritense the file from the diff I posted above is testdata/helmrelease/resume_helmrelease_from_git.golden

I see. I was checking the list before resources were fetched. It should be fixed now.

cmd/flux/resume.go Outdated Show resolved Hide resolved
Signed-off-by: Sjors Holtrop <[email protected]>
@matheuscscp
Copy link
Member

Thanks @sjorsholtrop-ritense !

@matheuscscp matheuscscp merged commit e09ba7a into fluxcd:main Jan 14, 2025
7 checks passed
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 this pull request may close these issues.

2 participants