diff --git a/cmd/helm/push.go b/cmd/helm/push.go index 24bd8af6b..f63b0a728 100644 --- a/cmd/helm/push.go +++ b/cmd/helm/push.go @@ -57,8 +57,5 @@ func newPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { }, } - f := cmd.Flags() - f.BoolVar(&client.WithProv, "with-prov", false, "upload .prov file") - return cmd } diff --git a/internal/experimental/action/push.go b/internal/experimental/action/push.go index 3e1fd142f..cd20cedc4 100644 --- a/internal/experimental/action/push.go +++ b/internal/experimental/action/push.go @@ -30,7 +30,6 @@ import ( // It provides the implementation of 'helm push'. type Push struct { Settings *cli.EnvSettings - WithProv bool cfg *action.Configuration } @@ -60,9 +59,7 @@ func (p *Push) Run(chartRef string, remote string) (string, error) { c := uploader.ChartUploader{ Out: &out, Pushers: pusher.All(p.Settings), - Options: []pusher.Option{ - pusher.WithProvenance(p.WithProv), - }, + Options: []pusher.Option{}, } if strings.HasPrefix(remote, "oci://") { diff --git a/internal/experimental/pusher/ocipusher.go b/internal/experimental/pusher/ocipusher.go index 034113634..01b1176f5 100644 --- a/internal/experimental/pusher/ocipusher.go +++ b/internal/experimental/pusher/ocipusher.go @@ -18,6 +18,7 @@ package pusher import ( "fmt" "io/ioutil" + "os" "path" "strings" @@ -52,10 +53,9 @@ func (pusher *OCIPusher) push(chartRef, href string) error { } var pushOpts []registry.PushOption - var provBytes []byte - if pusher.opts.withProv { - provRef := fmt.Sprintf("%s.prov", chartRef) - provBytes, err = ioutil.ReadFile(provRef) + provRef := fmt.Sprintf("%s.prov", chartRef) + if _, err := os.Stat(provRef); err == nil { + provBytes, err := ioutil.ReadFile(provRef) if err != nil { return err } diff --git a/internal/experimental/pusher/pusher.go b/internal/experimental/pusher/pusher.go index dea8d962a..05edb8295 100644 --- a/internal/experimental/pusher/pusher.go +++ b/internal/experimental/pusher/pusher.go @@ -27,7 +27,6 @@ import ( // // Pushers may or may not ignore these parameters as they are passed in. type options struct { - withProv bool registryClient *registry.Client } @@ -42,13 +41,6 @@ func WithRegistryClient(client *registry.Client) Option { } } -// WithProvenance sets the withProv option. -func WithProvenance(withProv bool) Option { - return func(opts *options) { - opts.withProv = withProv - } -} - // Pusher is an interface to support upload to the specified URL. type Pusher interface { // Push file content by url string