From 60f5a6a2869792f7974f642688263ce4e2922414 Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sun, 20 Oct 2024 18:20:18 +1100 Subject: [PATCH 1/5] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- cmd/argo/commands/archive/list.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/argo/commands/archive/list.go b/cmd/argo/commands/archive/list.go index 1ea5946537b6..304b399eb71a 100644 --- a/cmd/argo/commands/archive/list.go +++ b/cmd/argo/commands/archive/list.go @@ -21,6 +21,7 @@ func NewListCommand() *cobra.Command { selector string output = common.NewPrintWorkflowOutputValue("wide") chunkSize int64 + prefix string ) command := &cobra.Command{ Use: "list", @@ -47,7 +48,7 @@ func NewListCommand() *cobra.Command { return err } namespace := client.Namespace() - workflows, err := listArchivedWorkflows(ctx, serviceClient, namespace, selector, chunkSize) + workflows, err := listArchivedWorkflows(ctx, serviceClient, namespace, selector, chunkSize, prefix) if err != nil { return err } @@ -55,12 +56,13 @@ func NewListCommand() *cobra.Command { }, } command.Flags().VarP(&output, "output", "o", "Output format. "+output.Usage()) + command.Flags().StringVar(&prefix, "prefix", "", "Filter workflows by prefix") command.Flags().StringVarP(&selector, "selector", "l", "", "Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)") command.Flags().Int64VarP(&chunkSize, "chunk-size", "", 0, "Return large lists in chunks rather than all at once. Pass 0 to disable.") return command } -func listArchivedWorkflows(ctx context.Context, serviceClient workflowarchivepkg.ArchivedWorkflowServiceClient, namespace string, labelSelector string, chunkSize int64) (wfv1.Workflows, error) { +func listArchivedWorkflows(ctx context.Context, serviceClient workflowarchivepkg.ArchivedWorkflowServiceClient, namespace string, labelSelector string, chunkSize int64, prefix string) (wfv1.Workflows, error) { listOpts := &metav1.ListOptions{ LabelSelector: labelSelector, Limit: chunkSize, @@ -68,7 +70,7 @@ func listArchivedWorkflows(ctx context.Context, serviceClient workflowarchivepkg var workflows wfv1.Workflows for { log.WithField("listOpts", listOpts).Debug() - resp, err := serviceClient.ListArchivedWorkflows(ctx, &workflowarchivepkg.ListArchivedWorkflowsRequest{Namespace: namespace, ListOptions: listOpts}) + resp, err := serviceClient.ListArchivedWorkflows(ctx, &workflowarchivepkg.ListArchivedWorkflowsRequest{Namespace: namespace, ListOptions: listOpts, NamePrefix: prefix}) if err != nil { return nil, err } From 8045fcc73df0a2414405f8b24978398ef6730d0a Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sun, 20 Oct 2024 18:22:55 +1100 Subject: [PATCH 2/5] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- docs/cli/argo_archive_list.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/cli/argo_archive_list.md b/docs/cli/argo_archive_list.md index 72f710582d72..ed3c1ae1b869 100644 --- a/docs/cli/argo_archive_list.md +++ b/docs/cli/argo_archive_list.md @@ -29,6 +29,7 @@ argo archive list [flags] --chunk-size int Return large lists in chunks rather than all at once. Pass 0 to disable. -h, --help help for list -o, --output string Output format. One of: name|json|yaml|wide (default "wide") + --prefix string Filter workflows by prefix -l, --selector string Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) ``` From eeec12787c34ec4ded00cdd3516807e8db9e55b2 Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sun, 20 Oct 2024 19:14:03 +1100 Subject: [PATCH 3/5] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- cmd/argo/commands/archive/retry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/argo/commands/archive/retry.go b/cmd/argo/commands/archive/retry.go index 585ee5b19606..c03bdbc7d6f4 100644 --- a/cmd/argo/commands/archive/retry.go +++ b/cmd/argo/commands/archive/retry.go @@ -111,7 +111,7 @@ func retryArchivedWorkflows(ctx context.Context, archiveServiceClient workflowar } var wfs wfv1.Workflows if retryOpts.hasSelector() { - wfs, err = listArchivedWorkflows(ctx, archiveServiceClient, retryOpts.fieldSelector, retryOpts.labelSelector, 0) + wfs, err = listArchivedWorkflows(ctx, archiveServiceClient, retryOpts.fieldSelector, retryOpts.labelSelector, 0, "") if err != nil { return err } From e9bc778f32032dfd210916385eb54005704cf179 Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sun, 20 Oct 2024 19:14:37 +1100 Subject: [PATCH 4/5] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- cmd/argo/commands/archive/resubmit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/argo/commands/archive/resubmit.go b/cmd/argo/commands/archive/resubmit.go index fb26dde5172e..6014bdaefb4e 100644 --- a/cmd/argo/commands/archive/resubmit.go +++ b/cmd/argo/commands/archive/resubmit.go @@ -105,7 +105,7 @@ func resubmitArchivedWorkflows(ctx context.Context, archiveServiceClient workflo ) if resubmitOpts.hasSelector() { - wfs, err = listArchivedWorkflows(ctx, archiveServiceClient, resubmitOpts.fieldSelector, resubmitOpts.labelSelector, 0) + wfs, err = listArchivedWorkflows(ctx, archiveServiceClient, resubmitOpts.fieldSelector, resubmitOpts.labelSelector, 0, "") if err != nil { return err } From 6125f6f8b3893d3182ef4d365a4757685010e777 Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sun, 20 Oct 2024 19:47:26 +1100 Subject: [PATCH 5/5] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- cmd/argo/commands/archive/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/argo/commands/archive/list.go b/cmd/argo/commands/archive/list.go index 304b399eb71a..1b40ff849e06 100644 --- a/cmd/argo/commands/archive/list.go +++ b/cmd/argo/commands/archive/list.go @@ -21,7 +21,7 @@ func NewListCommand() *cobra.Command { selector string output = common.NewPrintWorkflowOutputValue("wide") chunkSize int64 - prefix string + prefix string ) command := &cobra.Command{ Use: "list",