From c9c2d3a2a03e3a5d683179fa211cf7cead0ad7d3 Mon Sep 17 00:00:00 2001 From: Mostafa Negim Date: Mon, 21 Oct 2024 13:39:16 +0330 Subject: [PATCH] Fix: check for app.Name if is empty, and pick the args[0] if so #20474 Signed-off-by: Mostafa Negim --- cmd/util/app.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/util/app.go b/cmd/util/app.go index 025ef968097e5..1c170c737705b 100644 --- a/cmd/util/app.go +++ b/cmd/util/app.go @@ -605,6 +605,10 @@ func constructAppsFromFileUrl(fileURL, appName string, labels, annotations, args return nil, err } for _, app := range apps { + // if app.Name is empty, it should be picked from the command line + if len(args) == 1 && app.Name == "" { + app.Name = args[0] + } if len(args) == 1 && args[0] != app.Name { return nil, fmt.Errorf("app name '%s' does not match app spec metadata.name '%s'", args[0], app.Name) }