Skip to content

CLI app list should be able to filter based on a list of files #21052

@agaudreault

Description

@agaudreault

Summary

Argo CLI has multiple filters on the argocd app list command. However, none are allowing us to filter based on the source path. This is very useful for monorepos when filtering on the --repo returns too many applications.

Flags:
  -N, --app-namespace string   Only list applications in namespace
  -c, --cluster string         List apps by cluster name or url
  -h, --help                   help for list
  -o, --output string          Output format. One of: wide|name|json|yaml (default "wide")
  -p, --project stringArray    Filter by project name
  -r, --repo string            List apps by source repo URL
  -l, --selector string        List apps by label. Supports '=', '==', '!=', in, notin, exists & not exists. Matching apps must satisfy all of the specified label constraints.

Motivation

The main use case would be to find the affected applications in a repository based on a list of changed files.

Proposal

Adding two new filters. The first one would be --path string and it would return all applications that are syncing this path. For instance, if the argument --path example/apps/foo/chart is provided, then app1 would be returned.

APP			PATH
app1		example/apps/foo/chart
app2		example/apps/foo
app3		example/other

The second parameter would be -f, --file stringArray. When provided, the server will return any applications that are affected by the files, by evaluating the path and the argocd.argoproj.io/manifest-generate-paths annotation against each files. For instance, if the arguments --file example/apps/foo/base.yaml --file example/other/manifest.yaml are provided, app1 would be returned because example/apps/foo/base.yaml is part of example/apps/foo/chart/.., app2 because example/apps/foo/base.yaml is part of example/apps/foo and app4 because example/other/folder/manifest.yaml is part of example/other/..

APP			PATH							ANNOTATION
app1		example/apps/foo/chart			argocd.argoproj.io/manifest-generate-paths: .;..
app2		example/apps/foo				argocd.argoproj.io/manifest-generate-paths: .
app3		example/other						
app4		example/other					argocd.argoproj.io/manifest-generate-paths: .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions