From 214546427e76da21bbc61a5b70ec00d5b95f6d0b Mon Sep 17 00:00:00 2001 From: chenk Date: Thu, 16 Nov 2023 08:41:45 +0200 Subject: [PATCH] fix: k8s friendly error messages kbom non cluster scans (#5594) Signed-off-by: chenk --- pkg/k8s/commands/run.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/k8s/commands/run.go b/pkg/k8s/commands/run.go index df6836997632..9207363342c6 100644 --- a/pkg/k8s/commands/run.go +++ b/pkg/k8s/commands/run.go @@ -47,8 +47,14 @@ func Run(ctx context.Context, args []string, opts flag.Options) error { case clusterArtifact: return clusterRun(ctx, opts, cluster) case allArtifact: + if opts.Format == types.FormatCycloneDX { + return xerrors.Errorf("KBOM with CycloneDX format is not supported for all namespace scans") + } return namespaceRun(ctx, opts, cluster) default: // resourceArtifact + if opts.Format == types.FormatCycloneDX { + return xerrors.Errorf("KBOM with CycloneDX format is not supported for resource scans") + } return resourceRun(ctx, args, opts, cluster) } }