rename flag to bundle-from-oci
This commit is contained in:
parent
04e111db03
commit
3fd309bdde
3 changed files with 7 additions and 7 deletions
|
|
@ -84,14 +84,14 @@ func (opts *Options) AreFlagsValid() error {
|
|||
return fmt.Errorf("limit %d not allowed, must be between 1 and 1000", opts.Limit)
|
||||
}
|
||||
|
||||
// Check that the bundle-from-registry flag is only used with OCI artifact paths
|
||||
// Check that the bundle-from-oci flag is only used with OCI artifact paths
|
||||
if opts.UseBundleFromRegistry && !strings.HasPrefix(opts.ArtifactPath, "oci://") {
|
||||
return fmt.Errorf("bundle-from-registry flag can only be used with OCI artifact paths")
|
||||
return fmt.Errorf("bundle-from-oci flag can only be used with OCI artifact paths")
|
||||
}
|
||||
|
||||
// Check that both the bundle-from-registry and bundle-path flags are not used together
|
||||
// Check that both the bundle-from-oci and bundle-path flags are not used together
|
||||
if opts.UseBundleFromRegistry && opts.BundlePath != "" {
|
||||
return fmt.Errorf("bundle-from-registry flag cannot be used with bundle-path flag")
|
||||
return fmt.Errorf("bundle-from-oci flag cannot be used with bundle-path flag")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ func TestSetPolicyFlags(t *testing.T) {
|
|||
|
||||
err := opts.AreFlagsValid()
|
||||
require.Error(t, err)
|
||||
require.ErrorContains(t, err, "bundle-from-registry flag can only be used with OCI artifact paths")
|
||||
require.ErrorContains(t, err, "bundle-from-oci flag can only be used with OCI artifact paths")
|
||||
})
|
||||
|
||||
t.Run("does not return error when UseBundleFromRegistry is true and ArtifactPath is an OCI path", func(t *testing.T) {
|
||||
|
|
@ -157,6 +157,6 @@ func TestSetPolicyFlags(t *testing.T) {
|
|||
|
||||
err := opts.AreFlagsValid()
|
||||
require.Error(t, err)
|
||||
require.ErrorContains(t, err, "bundle-from-registry flag cannot be used with bundle-path flag")
|
||||
require.ErrorContains(t, err, "bundle-from-oci flag cannot be used with bundle-path flag")
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ func NewVerifyCmd(f *cmdutil.Factory, runF func(*Options) error) *cobra.Command
|
|||
// general flags
|
||||
verifyCmd.Flags().StringVarP(&opts.BundlePath, "bundle", "b", "", "Path to bundle on disk, either a single bundle in a JSON file or a JSON lines file with multiple bundles")
|
||||
cmdutil.DisableAuthCheckFlag(verifyCmd.Flags().Lookup("bundle"))
|
||||
verifyCmd.Flags().BoolVarP(&opts.UseBundleFromRegistry, "bundle-from-registry", "", false, "Use the bundle from the OCI registry when artifact is an OCI image")
|
||||
verifyCmd.Flags().BoolVarP(&opts.UseBundleFromRegistry, "bundle-from-oci", "", false, "When verifying an OCI image, fetch the attestation bundle from the OCI registry instead of from GitHub")
|
||||
cmdutil.StringEnumFlag(verifyCmd, &opts.DigestAlgorithm, "digest-alg", "d", "sha256", []string{"sha256", "sha512"}, "The algorithm used to compute a digest of the artifact")
|
||||
verifyCmd.Flags().StringVarP(&opts.Owner, "owner", "o", "", "GitHub organization to scope attestation lookup by")
|
||||
verifyCmd.Flags().StringVarP(&opts.Repo, "repo", "R", "", "Repository name in the format <owner>/<repo>")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue