fluxcd / helm-controller

The GitOps Toolkit Helm reconciler, for declarative Helming
https://fluxcd.io
Apache License 2.0
404 stars 161 forks source link

Fix incorrect use of format strings with the `conditions` package. #1025

Closed octo closed 1 month ago

octo commented 1 month ago

The Mark… functions in the conditions package accept a format string and (optional) arguments, just like fmt.Printf and friends.

In many places, the code passed an error message as the format string, causing it to be interpreted as a format string by the fmt package. This leads to issues when the message contains percent signs, e.g. URL-encoded values.

This PR adds a format string and shortens err.Error() to err, which yields the same output.

This change is identical in principle to fluxcd/source-controller#1529.

octo commented 1 month ago

Thanks for the quick reviews @stefanprodan! 🎉

stefanprodan commented 1 month ago

@octo please fix:

internal/reconcile/atomic_release.go:201:6: github.com/fluxcd/pkg/runtime/conditions.MarkStalled call needs 1 arg but has 2 args
octo commented 1 month ago

@octo please fix:

internal/reconcile/atomic_release.go:201:6: github.com/fluxcd/pkg/runtime/conditions.MarkStalled call needs 1 arg but has 2 args

✅ done

fluxcdbot commented 1 month ago

Successfully created backport PR for release/v1.0.x: