Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use argocd-commenter with multiple sources #849

Closed
bennesp opened this issue Jan 24, 2023 · 2 comments
Closed

Cannot use argocd-commenter with multiple sources #849

bennesp opened this issue Jan 24, 2023 · 2 comments

Comments

@bennesp
Copy link

bennesp commented Jan 24, 2023

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:

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

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

@bennesp bennesp changed the title Cannot use with multiple sources Cannot use argocd-commenter with multiple sources Jan 24, 2023
@int128
Copy link
Owner

int128 commented Sep 3, 2023

The new version https://github.com/int128/argocd-commenter/releases/tag/v1.15.0 supports the multiple sources feature.

@bennesp
Copy link
Author

bennesp commented Sep 3, 2023

Awesome, thank you!

@bennesp bennesp closed this as completed Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants