Skip to content

Commit

Permalink
Allow to use bundle with no kubeconfig
Browse files Browse the repository at this point in the history
It should be possible to list and push bundles without having to have a
valid kubeconfig. This change makes sure that no error is thrown if no
kubeconfig is found while invoking `tkn bundle`.
  • Loading branch information
davidmogar committed Apr 27, 2022
1 parent 31fc00c commit c037100
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/cmd/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package bundle

import (
"errors"
"strings"

"github.com/spf13/cobra"
"github.com/tektoncd/cli/pkg/cli"
Expand All @@ -35,7 +36,16 @@ func Command(p cli.Params) *cobra.Command {
"commandType": "main",
},
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return flags.InitParams(p, cmd)
if err := flags.InitParams(p, cmd); err != nil {
// this check allows tkn version to be run without
// a kubeconfig so users can list and push bundles
noConfigErr := strings.Contains(err.Error(), "no configuration has been provided")
if noConfigErr {
return nil
}
return err
}
return nil
},
}

Expand Down

0 comments on commit c037100

Please sign in to comment.