Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add blob policy import and show commands #1126

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

JeyJeyGao
Copy link
Contributor

@JeyJeyGao JeyJeyGao commented Dec 24, 2024

Feat:

  • added notation blob import and notation blob show commands

Test:

  • added E2E test cases

Corresponding spec:
https://github.com/notaryproject/notation/blob/2ff8754717877adfd45266cfa8ba65705c397ea0/specs/commandline/blob.md

help example:

$ notation -h

Notation - a tool to sign and verify artifacts

Usage:
  notation [command]

Available Commands:
  blob        Sign, verify and inspect singatures associated with blobs
  certificate Manage certificates in trust store
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  inspect     Inspect all signatures associated with the signed artifact
  key         Manage keys used for signing
  list        List signatures of the signed artifact
  login       Login to registry
  logout      Log out from the logged in registries
  plugin      Manage plugins
  policy      Manage trust policy configuration
  sign        Sign artifacts
  verify      Verify OCI artifacts
  version     Show the notation version information

Flags:
  -h, --help   help for notation

Use "notation [command] --help" for more information about a command.

$ notation blob -h

Sign, inspect, and verify signatures and configure trust policies.

Usage:
  notation blob [command]

Available Commands:
  policy      Manage trust policy configuration for signed blobs

Flags:
  -h, --help   help for blob

Use "notation blob [command] --help" for more information about a command.

$ notation blob policy -h

Manage trust policy configuration for arbitrary blob signature verification.

Usage:
  notation blob policy [command]

Available Commands:
  import      Import trust policy configuration from a JSON file
  show        Show trust policy configuration

Flags:
  -h, --help   help for policy

Use "notation blob policy [command] --help" for more information about a command.

$ notation blob policy import -h

Import blob trust policy configuration from a JSON file.

Example - Import trust policy configuration from a file:
  notation blob policy import my_policy.json

Usage:
  notation blob policy import [flags] <file_path>

Flags:
      --force   override the existing trust policy configuration, never prompt
  -h, --help    help for import

$ notation blob policy show -h

Show blob trust policy configuration.

Example - Show current blob trust policy configuration:
  notation blob policy show

Example - Save current blob trust policy configuration to a file:
  notation blob policy show > my_policy.json

Usage:
  notation blob policy show [flags]

Flags:
  -h, --help   help for show

Copy link

codecov bot commented Dec 24, 2024

Codecov Report

Attention: Patch coverage is 94.78261% with 6 lines in your changes missing coverage. Please review.

Project coverage is 73.30%. Comparing base (cd933da) to head (6b9922a).

Files with missing lines Patch % Lines
cmd/notation/blob/policy/import.go 89.65% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1126      +/-   ##
==========================================
+ Coverage   72.38%   73.30%   +0.91%     
==========================================
  Files          50       53       +3     
  Lines        3125     3240     +115     
==========================================
+ Hits         2262     2375     +113     
- Misses        670      671       +1     
- Partials      193      194       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JeyJeyGao JeyJeyGao changed the title feat: blob policy import & show commands feat: add blob policy import and show commands Dec 24, 2024
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
cmd/notation/blob/cmd.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy.go Outdated Show resolved Hide resolved
cmd/notation/internal/policy/show.go Outdated Show resolved Hide resolved
cmd/notation/internal/policy/show.go Outdated Show resolved Hide resolved
cmd/notation/internal/policy/import.go Outdated Show resolved Hide resolved
@JeyJeyGao JeyJeyGao requested a review from shizhMSFT December 27, 2024 08:12
cmd/notation/policy/show.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy.go Outdated Show resolved Hide resolved
@yizha1
Copy link
Contributor

yizha1 commented Dec 30, 2024

@JeyJeyGao why the spec you referenced didnot point to main branch?

@JeyJeyGao
Copy link
Contributor Author

@JeyJeyGao why the spec you referenced didnot point to main branch?

@yizha1 The link will be kept in the git history, so we need to pin the link to ensure the target file is not changed and remains accessible.

cmd/notation/blob/cmd.go Outdated Show resolved Hide resolved
cmd/notation/blob/cmd.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/cmd.go Outdated Show resolved Hide resolved
cmd/notation/blob/cmd.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/import.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/import.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/show.go Outdated Show resolved Hide resolved
@JeyJeyGao JeyJeyGao mentioned this pull request Jan 6, 2025
@JeyJeyGao JeyJeyGao requested a review from Two-Hearts January 6, 2025 06:52
cmd/notation/blob/cmd.go Outdated Show resolved Hide resolved
cmd/notation/blob/cmd.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/import.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/import.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/show.go Outdated Show resolved Hide resolved
Two-Hearts
Two-Hearts previously approved these changes Jan 7, 2025
Copy link
Contributor

@Two-Hearts Two-Hearts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cmd/notation/blob/policy/import.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/show.go Outdated Show resolved Hide resolved
cmd/notation/blob/policy/show.go Outdated Show resolved Hide resolved
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments in the last review.

Signed-off-by: Junjie Gao <[email protected]>
shizhMSFT
shizhMSFT previously approved these changes Jan 7, 2025
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Two-Hearts
Two-Hearts previously approved these changes Jan 8, 2025
Copy link
Contributor

@Two-Hearts Two-Hearts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Two-Hearts Two-Hearts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR depends on: notaryproject/notation-go#502 which fixes an error message of blob trust policy.

@Two-Hearts Two-Hearts self-requested a review January 9, 2025 07:54
@JeyJeyGao JeyJeyGao dismissed stale reviews from Two-Hearts and shizhMSFT via 0cb99f7 January 14, 2025 05:15
@JeyJeyGao
Copy link
Contributor Author

This PR depends on: notaryproject/notation-go#502 which fixes an error message of blob trust policy.

Updated.

@JeyJeyGao JeyJeyGao requested a review from shizhMSFT January 14, 2025 09:24
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants