Add bootstrap option to set a prefix for the commit messages
Signed-off-by: Dries Verachtert <dries.verachtert@dries.eu>
This commit is contained in:
@@ -51,6 +51,7 @@ type PlainGitBootstrapper struct {
|
||||
branch string
|
||||
|
||||
author git.Author
|
||||
commitMessagePrefix string
|
||||
commitMessageAppendix string
|
||||
|
||||
kubeconfig string
|
||||
@@ -133,6 +134,9 @@ func (b *PlainGitBootstrapper) ReconcileComponents(ctx context.Context, manifest
|
||||
|
||||
// Git commit generated
|
||||
commitMsg := fmt.Sprintf("Add Flux %s component manifests", options.Version)
|
||||
if b.commitMessagePrefix != "" {
|
||||
commitMsg = b.commitMessagePrefix + commitMsg
|
||||
}
|
||||
if b.commitMessageAppendix != "" {
|
||||
commitMsg = commitMsg + "\n\n" + b.commitMessageAppendix
|
||||
}
|
||||
@@ -297,6 +301,9 @@ func (b *PlainGitBootstrapper) ReconcileSyncConfig(ctx context.Context, options
|
||||
|
||||
// Git commit generated
|
||||
commitMsg := fmt.Sprintf("Add Flux sync manifests")
|
||||
if b.commitMessagePrefix != "" {
|
||||
commitMsg = b.commitMessagePrefix + commitMsg
|
||||
}
|
||||
if b.commitMessageAppendix != "" {
|
||||
commitMsg = commitMsg + "\n\n" + b.commitMessageAppendix
|
||||
}
|
||||
|
||||
@@ -62,6 +62,20 @@ func (o authorOption) applyGitProvider(b *GitProviderBootstrapper) {
|
||||
o.applyGit(b.PlainGitBootstrapper)
|
||||
}
|
||||
|
||||
func WithCommitMessagePrefix(prefix string) Option {
|
||||
return commitMessagePrefixOption(prefix)
|
||||
}
|
||||
|
||||
type commitMessagePrefixOption string
|
||||
|
||||
func (o commitMessagePrefixOption) applyGit(b *PlainGitBootstrapper) {
|
||||
b.commitMessagePrefix = string(o)
|
||||
}
|
||||
|
||||
func (o commitMessagePrefixOption) applyGitProvider(b *GitProviderBootstrapper) {
|
||||
o.applyGit(b.PlainGitBootstrapper)
|
||||
}
|
||||
|
||||
func WithCommitMessageAppendix(appendix string) Option {
|
||||
return commitMessageAppendixOption(appendix)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user