-
Notifications
You must be signed in to change notification settings - Fork 15
Description
ArgoCD v2.6 ships with a very nice feature that enables people to use multiple sources in a single Application.
This can come very handy when you want for example to define helm values in separate file in the Git repository, or for many other use cases. For further references, see here https://github.com/argoproj/argo-cd/blob/master/docs/proposals/multiple-sources-for-applications.md and here argoproj/argo-cd#10432
The current implementation of argocd-commenter is using only the .source part of the spec, ignoring the .sources one, in this function:
argocd-commenter/pkg/notification/comment.go
Lines 23 to 41 in d1ff3d3
| func NewCommentOnOnPhaseChanged(app argocdv1alpha1.Application, argocdURL string) *Comment { | |
| repository := github.ParseRepositoryURL(app.Spec.Source.RepoURL) | |
| if repository == nil { | |
| return nil | |
| } | |
| revision := argocd.GetDeployedRevision(app) | |
| if revision == "" { | |
| return nil | |
| } | |
| body := generateCommentOnPhaseChanged(app, argocdURL) | |
| if body == "" { | |
| return nil | |
| } | |
| return &Comment{ | |
| GitHubRepository: *repository, | |
| Revision: revision, | |
| Body: body, | |
| } | |
| } |
A workaround like using both source and sources in the Application definition (so that ArgoCD will ignore the source while using the sources, while argocd-commenter will pick the source and will ignore the sources) won't work because of how the status is now: instead of using .revision, now we have .revisions, so the following function will return an empty string, causing the caller to return nil and thus not creating any comment
argocd-commenter/pkg/argocd/application.go
Lines 10 to 18 in d1ff3d3
| func GetDeployedRevision(a argocdv1alpha1.Application) string { | |
| if a.Status.OperationState == nil { | |
| return "" | |
| } | |
| if a.Status.OperationState.Operation.Sync == nil { | |
| return "" | |
| } | |
| return a.Status.OperationState.Operation.Sync.Revision | |
| } |
It would be great to have the new "multiple sources" feature implemented also on this project