mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
refactor(cli): added equivalent subcommands for each flag combination under every command (#1674)
- image command is now deprecated in favor of 'images' - cve command is now deprecated in favor of 'cves' Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
+22
-5
@@ -54,7 +54,7 @@ import (
|
||||
"zotregistry.io/zot/pkg/storage"
|
||||
storageCommon "zotregistry.io/zot/pkg/storage/common"
|
||||
"zotregistry.io/zot/pkg/storage/local"
|
||||
"zotregistry.io/zot/pkg/storage/types"
|
||||
stypes "zotregistry.io/zot/pkg/storage/types"
|
||||
"zotregistry.io/zot/pkg/test/inject"
|
||||
"zotregistry.io/zot/pkg/test/mocks"
|
||||
)
|
||||
@@ -1437,12 +1437,12 @@ func ListNotarySignatures(reference string, tdir string) ([]godigest.Digest, err
|
||||
|
||||
sigRepo := notreg.NewRepository(remoteRepo)
|
||||
|
||||
artifectDesc, err := sigRepo.Resolve(ctx, reference)
|
||||
artifactDesc, err := sigRepo.Resolve(ctx, reference)
|
||||
if err != nil {
|
||||
return signatures, err
|
||||
}
|
||||
|
||||
err = sigRepo.ListSignatures(ctx, artifectDesc, func(signatureManifests []ispec.Descriptor) error {
|
||||
err = sigRepo.ListSignatures(ctx, artifactDesc, func(signatureManifests []ispec.Descriptor) error {
|
||||
for _, sigManifestDesc := range signatureManifests {
|
||||
signatures = append(signatures, sigManifestDesc.Digest)
|
||||
}
|
||||
@@ -2067,11 +2067,11 @@ func GetDefaultLayersBlobs() [][]byte {
|
||||
}
|
||||
}
|
||||
|
||||
func GetDefaultImageStore(rootDir string, log zLog.Logger) types.ImageStore {
|
||||
func GetDefaultImageStore(rootDir string, log zLog.Logger) stypes.ImageStore {
|
||||
return local.NewImageStore(rootDir, false, time.Hour, false, false, log,
|
||||
monitoring.NewMetricsServer(false, log),
|
||||
mocks.MockedLint{
|
||||
LintFn: func(repo string, manifestDigest godigest.Digest, imageStore types.ImageStore) (bool, error) {
|
||||
LintFn: func(repo string, manifestDigest godigest.Digest, imageStore stypes.ImageStore) (bool, error) {
|
||||
return true, nil
|
||||
},
|
||||
},
|
||||
@@ -2084,3 +2084,20 @@ func GetDefaultStoreController(rootDir string, log zLog.Logger) storage.StoreCon
|
||||
DefaultStore: GetDefaultImageStore(rootDir, log),
|
||||
}
|
||||
}
|
||||
|
||||
func RemoveLocalStorageContents(imageStore stypes.ImageStore) error {
|
||||
repos, err := imageStore.GetRepositories()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, repo := range repos {
|
||||
// take just the first path
|
||||
err = os.RemoveAll(filepath.Join(imageStore.RootDir(), filepath.SplitList(repo)[0]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ type ConfigBuilder interface {
|
||||
RandomConfig() ManifestBuilder
|
||||
}
|
||||
|
||||
// VulnerableConfigBuilder abstracts specifying the config of an vulnerage OCI image.
|
||||
// VulnerableConfigBuilder abstracts specifying the config of an vulnerable OCI image.
|
||||
// Keeping the RootFS field consistent with the vulnerable layers.
|
||||
type VulnerableConfigBuilder interface {
|
||||
// VulnerableConfig sets the given config while keeping the correct RootFS values for the
|
||||
|
||||
Reference in New Issue
Block a user