Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
505 changes: 477 additions & 28 deletions assets/swagger.json

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1662,14 +1662,14 @@ func checkForDeleteEvent(ctx context.Context, acdClient argocdclient.Client, app
}

// Print simple list of application names
func printApplicationNames(apps []argoappv1.Application) {
func printApplicationNames(apps []*argoappv1.Application) {
for _, app := range apps {
fmt.Println(app.QualifiedName())
}
}

// Print table of application data
func printApplicationTable(apps []argoappv1.Application, output *string) {
func printApplicationTable(apps []*argoappv1.Application, output *string) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
var fmtStr string
headers := []any{"NAME", "CLUSTER", "NAMESPACE", "PROJECT", "STATUS", "HEALTH", "SYNCPOLICY", "CONDITIONS"}
Expand All @@ -1683,13 +1683,13 @@ func printApplicationTable(apps []argoappv1.Application, output *string) {
for _, app := range apps {
vals := []any{
app.QualifiedName(),
getServer(&app),
getServer(app),
app.Spec.Destination.Namespace,
app.Spec.GetProject(),
app.Status.Sync.Status,
app.Status.Health.Status,
formatSyncPolicy(app),
formatConditionsSummary(app),
formatSyncPolicy(*app),
formatConditionsSummary(*app),
}
if *output == "wide" {
vals = append(vals, app.Spec.GetSource().RepoURL, app.Spec.GetSource().Path, app.Spec.GetSource().TargetRevision)
Expand Down Expand Up @@ -1726,24 +1726,23 @@ func NewApplicationListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co

conn, appIf := headless.NewClientOrDie(clientOpts, c).NewApplicationClientOrDie()
defer utilio.Close(conn)
listOpts := &application.ApplicationListOptions{}
if repo != "" {
listOpts.Repos = []string{repo}
}
if cluster != "" {
listOpts.Clusters = []string{cluster}
}
apps, err := appIf.List(ctx, &application.ApplicationQuery{
Selector: ptr.To(selector),
AppNamespace: &appNamespace,
Projects: projects,
Options: listOpts,
})

errors.CheckError(err)
appList := apps.Items

if len(projects) != 0 {
appList = argo.FilterByProjects(appList, projects)
}
if repo != "" {
appList = argo.FilterByRepo(appList, repo)
}
if cluster != "" {
appList = argo.FilterByCluster(appList, cluster)
}

switch output {
case "yaml", "json":
err := PrintResourceList(appList, output, false)
Expand Down
8 changes: 4 additions & 4 deletions cmd/argocd/commands/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ func TestPrintApplicationNames(t *testing.T) {
Name: "test",
},
}
printApplicationNames([]v1alpha1.Application{*app, *app})
printApplicationNames([]*v1alpha1.Application{app, app})
return nil
})
expectation := "test\ntest\n"
Expand Down Expand Up @@ -1568,7 +1568,7 @@ func TestPrintApplicationTableNotWide(t *testing.T) {
},
}
output := "table"
printApplicationTable([]v1alpha1.Application{*app, *app}, &output)
printApplicationTable([]*v1alpha1.Application{app, app}, &output)
return nil
})
require.NoError(t, err)
Expand Down Expand Up @@ -1604,7 +1604,7 @@ func TestPrintApplicationTableWide(t *testing.T) {
},
}
output := "wide"
printApplicationTable([]v1alpha1.Application{*app, *app}, &output)
printApplicationTable([]*v1alpha1.Application{app, app}, &output)
return nil
})
require.NoError(t, err)
Expand Down Expand Up @@ -2136,7 +2136,7 @@ func (c *fakeAppServiceClient) Get(_ context.Context, _ *applicationpkg.Applicat
}, nil
}

func (c *fakeAppServiceClient) List(_ context.Context, _ *applicationpkg.ApplicationQuery, _ ...grpc.CallOption) (*v1alpha1.ApplicationList, error) {
func (c *fakeAppServiceClient) List(_ context.Context, _ *applicationpkg.ApplicationQuery, _ ...grpc.CallOption) (*applicationpkg.ApplicationListResponse, error) {
return nil, nil
}

Expand Down
5 changes: 1 addition & 4 deletions cmd/argocd/commands/applicationset.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,7 @@ func NewApplicationSetGenerateCommand(clientOpts *argocdclient.ClientOptions) *c
resp, err := appIf.Generate(ctx, &req)
errors.CheckError(err)

var appsList []arogappsetv1.Application
for i := range resp.Applications {
appsList = append(appsList, *resp.Applications[i])
}
appsList := resp.Applications

switch output {
case "yaml", "json":
Expand Down
Loading
Loading