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: blob sign command #1128

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/notation/blob/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package blob provides the implementation of the `notation blob` command
package blob

import "github.com/spf13/cobra"
Expand Down
14 changes: 11 additions & 3 deletions test/e2e/suite/command/blob/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,20 @@ var _ = Describe("notation blob sign", func() {

It("with no permission to read the blob file", func() {
HostWithBlob(BaseOptions(), func(notation *utils.ExecOpts, blobPath string, vhost *utils.VirtualHost) {
if err := os.Chmod(blobPath, 0000); err != nil {
blobDir := filepath.Dir(blobPath)
Two-Hearts marked this conversation as resolved.
Show resolved Hide resolved
noPermissionBlobPath := filepath.Join(blobDir, "noPermissionBlob")
newBlobFile, err := os.Create(noPermissionBlobPath)
if err != nil {
Fail(err.Error())
}
defer newBlobFile.Close()

if err := os.Chmod(noPermissionBlobPath, 0000); err != nil {
Fail(err.Error())
}
defer os.Chmod(blobPath, 0700)
defer os.Chmod(noPermissionBlobPath, 0700)

notation.ExpectFailure().Exec("blob", "sign", blobPath).
notation.ExpectFailure().Exec("blob", "sign", noPermissionBlobPath).
MatchErrKeyWords("permission denied")
})
})
Expand Down
Loading