github.com/hiddeco/helm@v3.0.0-beta.3+incompatible/cmd/helm/verify.go (about)

     1  /*
     2  Copyright The Helm Authors.
     3  Licensed under the Apache License, Version 2.0 (the "License");
     4  you may not use this file except in compliance with the License.
     5  You may obtain a copy of the License at
     6  
     7  http://www.apache.org/licenses/LICENSE-2.0
     8  
     9  Unless required by applicable law or agreed to in writing, software
    10  distributed under the License is distributed on an "AS IS" BASIS,
    11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  See the License for the specific language governing permissions and
    13  limitations under the License.
    14  */
    15  
    16  package main
    17  
    18  import (
    19  	"io"
    20  
    21  	"github.com/spf13/cobra"
    22  
    23  	"helm.sh/helm/cmd/helm/require"
    24  	"helm.sh/helm/pkg/action"
    25  )
    26  
    27  const verifyDesc = `
    28  Verify that the given chart has a valid provenance file.
    29  
    30  Provenance files provide crytographic verification that a chart has not been
    31  tampered with, and was packaged by a trusted provider.
    32  
    33  This command can be used to verify a local chart. Several other commands provide
    34  '--verify' flags that run the same validation. To generate a signed package, use
    35  the 'helm package --sign' command.
    36  `
    37  
    38  func newVerifyCmd(out io.Writer) *cobra.Command {
    39  	client := action.NewVerify()
    40  
    41  	cmd := &cobra.Command{
    42  		Use:   "verify PATH",
    43  		Short: "verify that a chart at the given path has been signed and is valid",
    44  		Long:  verifyDesc,
    45  		Args:  require.ExactArgs(1),
    46  		RunE: func(cmd *cobra.Command, args []string) error {
    47  			return client.Run(args[0])
    48  		},
    49  	}
    50  
    51  	cmd.Flags().StringVar(&client.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")
    52  
    53  	return cmd
    54  }