Skip to content

feat: add blob policy import and show commands #1126

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

Merged
merged 27 commits into from
Jan 15, 2025

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

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
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).
Report is 4 commits behind head on main.

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 <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
@JeyJeyGao JeyJeyGao requested a review from shizhMSFT December 27, 2024 08:12
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
@JeyJeyGao JeyJeyGao mentioned this pull request Jan 6, 2025
@JeyJeyGao JeyJeyGao requested a review from Two-Hearts January 6, 2025 06:52
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Two-Hearts
Two-Hearts previously approved these changes Jan 7, 2025
Copy link

@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

@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 <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
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

@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

@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
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
@JeyJeyGao JeyJeyGao dismissed stale reviews from Two-Hearts and shizhMSFT via 0cb99f7 January 14, 2025 05:15
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
@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

Copy link

@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

@JeyJeyGao JeyJeyGao merged commit 2920cae into notaryproject:main Jan 15, 2025
7 checks passed
@JeyJeyGao JeyJeyGao deleted the feat/blob_policy_cmd branch January 15, 2025 05:37
7h3-3mp7y-m4n pushed a commit to 7h3-3mp7y-m4n/notation that referenced this pull request Mar 29, 2025
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
```

---------

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
FeynmanZhou pushed a commit to FeynmanZhou/notation that referenced this pull request May 15, 2025
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
```

---------

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
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