fluxcd / flux

Successor: https://github.com/fluxcd/flux2
https://fluxcd.io
Apache License 2.0
6.9k stars 1.08k forks source link

Custom commit message on auto-release #3590

Closed marcoacarvalho closed 2 years ago

marcoacarvalho commented 2 years ago

Hi, Sorry if this is the wrong place I use fluxcd helm chart with "fluxcd.io/automated: true" on my HelmRelease It works fine but our git repository now have a commit checker that requires a certain string on the commit message My question is: There is a way to add a custom string to the commit message?

kingdonb commented 2 years ago

Flux v2 has this option in ImageUpdateAutomation which is configurable:

// MessageTemplate provides a template for the commit message,
--
113 | // into which will be interpolated the details of the change made.
114 | // +optional
115 | MessageTemplate string `json:"messageTemplate,omitempty"`

If you are using the Flux helm chart and fluxcd.io/automated: true annotation, then you are in the right place, this is Flux v1. All users are advised to upgrade, as only limited support is available here.

You can always find the Flux v1 docs at: https://fluxcd.io/legacy/flux/ (I mention this because we have de-emphasized the Flux v1 project significantly, both in terms of developer effort and also marketing footprint, so it is really harder to find the legacy docs by accident or on purpose right now, if you don't already know where to look for them.)

I see this is relevant, but not quite what you asked for:

https://fluxcd.io/legacy/flux/references/fluxctl/#commit-customization

You can set a custom commit message when triggering an update manually through fluxctl – this is not automated, unless you write it into a CI/CD script (and then, of course if you follow the literature, you know it's no longer GitOps but "CI Ops")

The only relevant options I can find for fluxd, the daemon that processes that annotation, are here:

–git-ci-skip | false | when set, fluxd will append \n\n[ci skip] to its commit messages –git-ci-skip-message | "" | if provided, fluxd will append this to commit messages (overrides –git-ci-skip)`

So you can append a message but there is no templating capability, depending on what you mean by custom string, you may need to upgrade to Flux v2 in order to enjoy this capability.

If what you're looking for is something like ci-skip though, that should suffice! Hope this helps!

marcoacarvalho commented 2 years ago

Thank you very much @kingdonb I think –git-ci-skip-message is what I'm looking for I will take a look