argocd-image-updater icon indicating copy to clipboard operation
argocd-image-updater copied to clipboard

Make application metadata/spec available to commit message template

Open jessesuen opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe.

Currently, we have the following variables available in the git commit message:

  • .AppName is the name of the application that is being updated
  • .AppChanges is a list of changes that were performed by the update. Each entry in this list is a struct providing the following information for each change:
  • .Image holds the full name of the image that was updated
  • .OldTag holds the tag name or SHA digest previous to the update
  • .NewTag holds the tag name or SHA digest that was updated to

They are passed to TemplateCommitMessage like so:

	if wbc.Method == WriteBackGit {
...
		if len(changeList) > 0 && updateConf.GitCommitMessage != nil {
			wbc.GitCommitMessage = TemplateCommitMessage(updateConf.GitCommitMessage, updateConf.UpdateApp.Application.Name, changeList)
		}
	}

We would like the ability to include additional metadata, namely Application labels and annotations to also be available to the TemplateCommitMessage, so that the content could be incorporated into the git commit message.

Describe the solution you'd like

TemplateCommitMessage could be improved to accept the Application object so that the template could access metadata in the application:

{{ .App.metadata.annotations["jira-ticket"] }}

jessesuen avatar May 03 '22 20:05 jessesuen