From 3fd309bdde0242dc46ff9a5a6473a5592361bce0 Mon Sep 17 00:00:00 2001 From: ejahnGithub Date: Mon, 19 Aug 2024 10:29:01 -0400 Subject: [PATCH] rename flag to bundle-from-oci --- pkg/cmd/attestation/verify/options.go | 8 ++++---- pkg/cmd/attestation/verify/options_test.go | 4 ++-- pkg/cmd/attestation/verify/verify.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/cmd/attestation/verify/options.go b/pkg/cmd/attestation/verify/options.go index a21e27c58..3ec2d49f1 100644 --- a/pkg/cmd/attestation/verify/options.go +++ b/pkg/cmd/attestation/verify/options.go @@ -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 diff --git a/pkg/cmd/attestation/verify/options_test.go b/pkg/cmd/attestation/verify/options_test.go index 9fd319041..b9be054a5 100644 --- a/pkg/cmd/attestation/verify/options_test.go +++ b/pkg/cmd/attestation/verify/options_test.go @@ -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") }) } diff --git a/pkg/cmd/attestation/verify/verify.go b/pkg/cmd/attestation/verify/verify.go index f77f5f822..f053240de 100644 --- a/pkg/cmd/attestation/verify/verify.go +++ b/pkg/cmd/attestation/verify/verify.go @@ -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 /")