Bug: kubechecks commenting on all repo's regardless of ArgoCD app
Even though Kubechecks will see that the repo is not part of ArgoCD (no applications), it will still comment "No changes" in a PR.
I question if this was intentional or not because we are checking the application and the appSets, and this information isn't important to repo's that don't use ArgoCD. The comment also says "skipping" which implies its not supposed to post anything.
Here is the code in question, and I think its best to just remove the PostMessage call.
kubechecks/pkg/events/check.go Line 276
if len(ce.affectedItems.Applications) <= 0 && len(ce.affectedItems.ApplicationSets) <= 0 {
ce.logger.Info().Msg("No affected apps or appsets, skipping")
if _, err := ce.ctr.VcsClient.PostMessage(ctx, ce.pullRequest, fmt.Sprintf("## Kubechecks %s Report\nNo changes", ce.ctr.Config.Identifier)); err != nil {
return errors.Wrap(err, "failed to post changes")
}
return nil
}
yeah, feels like kubechecks shouldn't comment on repos with no argocd apps. I don't think it's a bug thought, it's an enhancement. Kubechecks does what it's meant to do; listen for webhook events and check if any apps have been modified in there. Webhooks should not be added to repos that don't contain argo configs, but I understand in some cases webhooks are added globally depending on setup. For that, the workaround is to ådd the webhooks only on repos that argocd pulls from.
Happy to take a PR if you can.