argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
16.73k stars 5.07k forks source link

Support label selectors In ApplicationSet Pull Request generator #12300

Open mnacharov opened 1 year ago

mnacharov commented 1 year ago

Summary

Allow negative matching on pull request labels. Create applications for pull requests that doesn't have Stale label

Motivation

In most of my use-cases, PR stands are created by default to run some integration tests on them and/or preview changes as part of a code review. Therefore, I would like to have ability to stop those stands by labeling PR as Stale rather than by removing label preview from PR.

Proposal

Add notLabels in addition to labels filter in pullRequest generator. Filter the PRs to those not containing any of the labels listed

blakepettersson commented 1 year ago

Perhaps it could make sense to have matchExpressions, i.e something more akin to how Deployments et al does filtering?

jessesuen commented 1 year ago

Create applications for pull requests that doesn't have Stale label

I've heard of similar request from users and agree with the use case.

Perhaps it could make sense to have matchExpressions

This seems like a more flexible way to achieve the use case. I like the proposal.

llavaud commented 7 months ago

Perhaps it could make sense to have matchExpressions, i.e something more akin to how Deployments et al does filtering?

could be useful to also have support for wildcard or Contains operator !

crenshaw-dev commented 7 months ago

@llavaud I think you could achieve the same thing using go templates, the generator's values field, and the label selector: https://github.com/argoproj/argo-cd/issues/16447#issuecomment-1834716969