mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 20:07:55 +08:00
build(deps): bump all dependencies (#2532)
* build(deps): bump all dependencies Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de> * build(deps): bump all dependencies Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de> Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de> * build(deps): bump all dependencies Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de> Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de> * build(deps): bump all dependencies Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de> --------- Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de> Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
This commit is contained in:
+24
-8
@@ -668,16 +668,32 @@ func applyDefaultValues(config *config.Config, viperInstance *viper.Viper, log z
|
||||
config.Storage.RemoteCache = true
|
||||
}
|
||||
|
||||
// s3 dedup=false, check for previous dedupe usage and set to true if cachedb found
|
||||
if !config.Storage.Dedupe && config.Storage.StorageDriver != nil {
|
||||
cacheDir, _ := config.Storage.StorageDriver["rootdirectory"].(string)
|
||||
cachePath := path.Join(cacheDir, storageConstants.BoltdbName+storageConstants.DBExtensionName)
|
||||
if config.Storage.StorageDriver != nil {
|
||||
// s3 dedup=false, check for previous dedupe usage and set to true if cachedb found
|
||||
if !config.Storage.Dedupe {
|
||||
cacheDir, _ := config.Storage.StorageDriver["rootdirectory"].(string)
|
||||
cachePath := path.Join(cacheDir, storageConstants.BoltdbName+storageConstants.DBExtensionName)
|
||||
|
||||
if _, err := os.Stat(cachePath); err == nil {
|
||||
log.Info().Str("component", "config").Msg("dedupe set to false for s3 driver but used to be true.")
|
||||
log.Info().Str("cache path", cachePath).Msg("found cache database")
|
||||
if _, err := os.Stat(cachePath); err == nil {
|
||||
log.Info().Str("component", "config").Msg("dedupe set to false for s3 driver but used to be true.")
|
||||
log.Info().Str("cache path", cachePath).Msg("found cache database")
|
||||
|
||||
config.Storage.RemoteCache = false
|
||||
config.Storage.RemoteCache = false
|
||||
}
|
||||
}
|
||||
|
||||
// backward compatibility for s3 storage driver
|
||||
// if regionendpoint is provided, forcepathstyle should be set to true
|
||||
// ref: https://github.com/distribution/distribution/pull/4291
|
||||
if config.Storage.StorageDriver["name"] == storageConstants.S3StorageDriverName {
|
||||
_, hasRegionEndpoint := config.Storage.StorageDriver["regionendpoint"]
|
||||
_, hasForcePathStyle := config.Storage.StorageDriver["forcepathstyle"]
|
||||
|
||||
if hasRegionEndpoint && !hasForcePathStyle {
|
||||
log.Warn().
|
||||
Msg("deprecated: automatically setting forcepathstyle to true for s3 storage driver.")
|
||||
config.Storage.StorageDriver["forcepathstyle"] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/image-spec/schema"
|
||||
imeta "github.com/opencontainers/image-spec/specs-go"
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/distribution/registry/storage/driver/factory"
|
||||
_ "github.com/docker/distribution/registry/storage/driver/s3-aws"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver/factory"
|
||||
_ "github.com/distribution/distribution/v3/registry/storage/driver/s3-aws"
|
||||
guuid "github.com/gofrs/uuid"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"gopkg.in/resty.v1"
|
||||
@@ -89,11 +89,12 @@ func TestGarbageCollectAndRetention(t *testing.T) {
|
||||
"secretkey": "minioadmin",
|
||||
"secure": false,
|
||||
"skipverify": false,
|
||||
"forcepathstyle": true,
|
||||
}
|
||||
|
||||
storeName := fmt.Sprintf("%v", storageDriverParams["name"])
|
||||
|
||||
store, err := factory.Create(storeName, storageDriverParams)
|
||||
store, err := factory.Create(context.Background(), storeName, storageDriverParams)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
guuid "github.com/gofrs/uuid"
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@@ -376,7 +376,7 @@ func (is *ImageStore) GetNextRepository(repo string) (string, error) {
|
||||
}
|
||||
|
||||
if errors.Is(err, io.EOF) ||
|
||||
(errors.As(err, driverErr) && errors.Is(driverErr.Enclosed, io.EOF)) {
|
||||
(errors.As(err, driverErr) && errors.Is(driverErr.Detail, io.EOF)) {
|
||||
return store, nil
|
||||
}
|
||||
|
||||
@@ -846,7 +846,7 @@ func (is *ImageStore) FinishBlobUpload(repo, uuid string, body io.Reader, dstDig
|
||||
return zerr.ErrUploadNotFound
|
||||
}
|
||||
|
||||
if err := fileWriter.Commit(); err != nil {
|
||||
if err := fileWriter.Commit(context.Background()); err != nil {
|
||||
is.log.Error().Err(err).Msg("failed to commit file")
|
||||
|
||||
return err
|
||||
@@ -946,7 +946,7 @@ func (is *ImageStore) FullBlobUpload(repo string, body io.Reader, dstDigest godi
|
||||
return "", -1, err
|
||||
}
|
||||
|
||||
if err := blobFile.Commit(); err != nil {
|
||||
if err := blobFile.Commit(context.Background()); err != nil {
|
||||
is.log.Error().Err(err).Str("blob", src).Msg("failed to commit blob")
|
||||
|
||||
return "", -1, err
|
||||
@@ -1104,7 +1104,7 @@ func (is *ImageStore) DeleteBlobUpload(repo, uuid string) error {
|
||||
|
||||
defer writer.Close()
|
||||
|
||||
if err := writer.Cancel(); err != nil {
|
||||
if err := writer.Cancel(context.Background()); err != nil {
|
||||
is.log.Error().Err(err).Str("blobUploadPath", blobUploadPath).Msg("failed to delete blob upload")
|
||||
|
||||
return err
|
||||
|
||||
@@ -3,6 +3,7 @@ package local
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
@@ -11,7 +12,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
storagedriver "github.com/docker/distribution/registry/storage/driver"
|
||||
storagedriver "github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
|
||||
zerr "zotregistry.dev/zot/errors"
|
||||
storageConstants "zotregistry.dev/zot/pkg/storage/constants"
|
||||
@@ -177,7 +178,7 @@ func (driver *Driver) WriteFile(filepath string, content []byte) (int, error) {
|
||||
|
||||
nbytes, err := io.Copy(writer, bytes.NewReader(content))
|
||||
if err != nil {
|
||||
_ = writer.Cancel()
|
||||
_ = writer.Cancel(context.Background())
|
||||
|
||||
return -1, driver.formatErr(err)
|
||||
}
|
||||
@@ -316,7 +317,7 @@ func (driver *Driver) formatErr(err error) error {
|
||||
default:
|
||||
storageError := storagedriver.Error{
|
||||
DriverName: driver.Name(),
|
||||
Enclosed: err,
|
||||
Detail: err,
|
||||
}
|
||||
|
||||
return storageError
|
||||
@@ -421,7 +422,7 @@ func (fw *fileWriter) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fw *fileWriter) Cancel() error {
|
||||
func (fw *fileWriter) Cancel(_ context.Context) error {
|
||||
if fw.closed {
|
||||
return zerr.ErrFileAlreadyClosed
|
||||
}
|
||||
@@ -432,7 +433,7 @@ func (fw *fileWriter) Cancel() error {
|
||||
return os.Remove(fw.file.Name())
|
||||
}
|
||||
|
||||
func (fw *fileWriter) Commit() error {
|
||||
func (fw *fileWriter) Commit(_ context.Context) error {
|
||||
//nolint: gocritic
|
||||
if fw.closed {
|
||||
return zerr.ErrFileAlreadyClosed
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
storagedriver "github.com/docker/distribution/registry/storage/driver"
|
||||
storagedriver "github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
|
||||
storageConstants "zotregistry.dev/zot/pkg/storage/constants"
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"io"
|
||||
|
||||
// Add s3 support.
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
_ "github.com/docker/distribution/registry/storage/driver/s3-aws"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
_ "github.com/distribution/distribution/v3/registry/storage/driver/s3-aws"
|
||||
|
||||
storageConstants "zotregistry.dev/zot/pkg/storage/constants"
|
||||
)
|
||||
@@ -65,7 +65,7 @@ func (driver *Driver) WriteFile(filepath string, content []byte) (int, error) {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
if err := stwr.Commit(); err != nil {
|
||||
if err := stwr.Commit(context.Background()); err != nil {
|
||||
return -1, err
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -2,9 +2,9 @@ package s3
|
||||
|
||||
import (
|
||||
// Add s3 support.
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
// Load s3 driver.
|
||||
_ "github.com/docker/distribution/registry/storage/driver/s3-aws"
|
||||
_ "github.com/distribution/distribution/v3/registry/storage/driver/s3-aws"
|
||||
|
||||
"zotregistry.dev/zot/pkg/extensions/monitoring"
|
||||
zlog "zotregistry.dev/zot/pkg/log"
|
||||
|
||||
+54
-41
@@ -8,15 +8,16 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
"github.com/docker/distribution/registry/storage/driver/factory"
|
||||
_ "github.com/docker/distribution/registry/storage/driver/s3-aws"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver/factory"
|
||||
_ "github.com/distribution/distribution/v3/registry/storage/driver/s3-aws"
|
||||
guuid "github.com/gofrs/uuid"
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@@ -103,11 +104,12 @@ func createStoreDriver(rootDir string) driver.StorageDriver {
|
||||
"secretkey": "minioadmin",
|
||||
"secure": false,
|
||||
"skipverify": false,
|
||||
"forcepathstyle": true,
|
||||
}
|
||||
|
||||
storeName := fmt.Sprintf("%v", storageDriverParams["name"])
|
||||
|
||||
store, err := factory.Create(storeName, storageDriverParams)
|
||||
store, err := factory.Create(context.Background(), storeName, storageDriverParams)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -185,9 +187,9 @@ func createObjectsStoreDynamo(rootDir string, cacheDir string, dedupe bool, tabl
|
||||
}
|
||||
|
||||
func runAndGetScheduler() *scheduler.Scheduler {
|
||||
logger := log.Logger{}
|
||||
metrics := monitoring.NewMetricsServer(false, logger)
|
||||
taskScheduler := scheduler.NewScheduler(config.New(), metrics, logger)
|
||||
log := log.Logger{}
|
||||
metrics := monitoring.NewMetricsServer(false, log)
|
||||
taskScheduler := scheduler.NewScheduler(config.New(), metrics, log)
|
||||
taskScheduler.RateLimit = 50 * time.Millisecond
|
||||
|
||||
taskScheduler.RunScheduler()
|
||||
@@ -240,7 +242,7 @@ func (f *FileWriterMock) Size() int64 {
|
||||
return int64(fileWriterSize)
|
||||
}
|
||||
|
||||
func (f *FileWriterMock) Cancel() error {
|
||||
func (f *FileWriterMock) Cancel(_ context.Context) error {
|
||||
if f != nil && f.CancelFn != nil {
|
||||
return f.CancelFn()
|
||||
}
|
||||
@@ -248,7 +250,7 @@ func (f *FileWriterMock) Cancel() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *FileWriterMock) Commit() error {
|
||||
func (f *FileWriterMock) Commit(_ context.Context) error {
|
||||
if f != nil && f.CommitFn != nil {
|
||||
return f.CommitFn()
|
||||
}
|
||||
@@ -273,16 +275,25 @@ func (f *FileWriterMock) Close() error {
|
||||
}
|
||||
|
||||
type StorageDriverMock struct {
|
||||
NameFn func() string
|
||||
GetContentFn func(ctx context.Context, path string) ([]byte, error)
|
||||
PutContentFn func(ctx context.Context, path string, content []byte) error
|
||||
ReaderFn func(ctx context.Context, path string, offset int64) (io.ReadCloser, error)
|
||||
WriterFn func(ctx context.Context, path string, isAppend bool) (driver.FileWriter, error)
|
||||
StatFn func(ctx context.Context, path string) (driver.FileInfo, error)
|
||||
ListFn func(ctx context.Context, path string) ([]string, error)
|
||||
MoveFn func(ctx context.Context, sourcePath, destPath string) error
|
||||
DeleteFn func(ctx context.Context, path string) error
|
||||
WalkFn func(ctx context.Context, path string, f driver.WalkFn) error
|
||||
NameFn func() string
|
||||
GetContentFn func(ctx context.Context, path string) ([]byte, error)
|
||||
PutContentFn func(ctx context.Context, path string, content []byte) error
|
||||
ReaderFn func(ctx context.Context, path string, offset int64) (io.ReadCloser, error)
|
||||
WriterFn func(ctx context.Context, path string, isAppend bool) (driver.FileWriter, error)
|
||||
StatFn func(ctx context.Context, path string) (driver.FileInfo, error)
|
||||
ListFn func(ctx context.Context, path string) ([]string, error)
|
||||
MoveFn func(ctx context.Context, sourcePath, destPath string) error
|
||||
DeleteFn func(ctx context.Context, path string) error
|
||||
WalkFn func(ctx context.Context, path string, f driver.WalkFn, options ...func(*driver.WalkOptions)) error
|
||||
RedirectURLFn func(r *http.Request, path string) (string, error)
|
||||
}
|
||||
|
||||
func (s *StorageDriverMock) RedirectURL(r *http.Request, path string) (string, error) {
|
||||
if s != nil && s.RedirectURLFn != nil {
|
||||
return s.RedirectURLFn(r, path)
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (s *StorageDriverMock) Name() string {
|
||||
@@ -361,9 +372,11 @@ func (s *StorageDriverMock) URLFor(ctx context.Context, path string, options map
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (s *StorageDriverMock) Walk(ctx context.Context, path string, f driver.WalkFn) error {
|
||||
func (s *StorageDriverMock) Walk(ctx context.Context, path string, f driver.WalkFn,
|
||||
options ...func(*driver.WalkOptions),
|
||||
) error {
|
||||
if s != nil && s.WalkFn != nil {
|
||||
return s.WalkFn(ctx, path, f)
|
||||
return s.WalkFn(ctx, path, f, options...)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -801,7 +814,7 @@ func TestNegativeCasesObjectsStorage(t *testing.T) {
|
||||
ReaderFn: func(ctx context.Context, path string, offset int64) (io.ReadCloser, error) {
|
||||
return io.NopCloser(strings.NewReader("")), errS3
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, f driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, f driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
return errS3
|
||||
},
|
||||
StatFn: func(ctx context.Context, path string) (driver.FileInfo, error) {
|
||||
@@ -871,7 +884,7 @@ func TestNegativeCasesObjectsStorage(t *testing.T) {
|
||||
|
||||
Convey("Test GetRepositories", func(c C) {
|
||||
imgStore = createMockStorage(testDir, tdir, false, &StorageDriverMock{
|
||||
WalkFn: func(ctx context.Context, path string, f driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, f driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
return f(new(FileInfoMock))
|
||||
},
|
||||
})
|
||||
@@ -1979,9 +1992,9 @@ func TestRebuildDedupeIndex(t *testing.T) {
|
||||
|
||||
Convey("Intrerrupt rebuilding and restart, checking idempotency", func() {
|
||||
for i := 0; i < 10; i++ {
|
||||
logger := log.Logger{}
|
||||
metrics := monitoring.NewMetricsServer(false, logger)
|
||||
taskScheduler := scheduler.NewScheduler(config.New(), metrics, logger)
|
||||
log := log.Logger{}
|
||||
metrics := monitoring.NewMetricsServer(false, log)
|
||||
taskScheduler := scheduler.NewScheduler(config.New(), metrics, log)
|
||||
taskScheduler.RateLimit = 1 * time.Millisecond
|
||||
|
||||
taskScheduler.RunScheduler()
|
||||
@@ -2021,9 +2034,9 @@ func TestRebuildDedupeIndex(t *testing.T) {
|
||||
|
||||
// now from dedupe false to true
|
||||
for i := 0; i < 10; i++ {
|
||||
logger := log.Logger{}
|
||||
metrics := monitoring.NewMetricsServer(false, logger)
|
||||
taskScheduler := scheduler.NewScheduler(config.New(), metrics, logger)
|
||||
log := log.Logger{}
|
||||
metrics := monitoring.NewMetricsServer(false, log)
|
||||
taskScheduler := scheduler.NewScheduler(config.New(), metrics, log)
|
||||
taskScheduler.RateLimit = 1 * time.Millisecond
|
||||
|
||||
taskScheduler.RunScheduler()
|
||||
@@ -2199,7 +2212,7 @@ func TestNextRepositoryMockStoreDriver(t *testing.T) {
|
||||
ListFn: func(ctx context.Context, path string) ([]string, error) {
|
||||
return []string{}, nil
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
return driver.PathNotFoundError{}
|
||||
},
|
||||
})
|
||||
@@ -2227,7 +2240,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
StatFn: func(ctx context.Context, path string) (driver.FileInfo, error) {
|
||||
return &FileInfoMock{}, errS3
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
return walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2263,7 +2276,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2312,7 +2325,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2361,7 +2374,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, errS3
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2406,7 +2419,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, errS3
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2454,7 +2467,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2505,7 +2518,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2553,7 +2566,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, errS3
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2585,7 +2598,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
Convey("Trigger getNextDigestWithBlobPaths err", t, func() {
|
||||
tdir := t.TempDir()
|
||||
imgStore := createMockStorage(testDir, tdir, true, &StorageDriverMock{
|
||||
WalkFn: func(ctx context.Context, path string, f driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, f driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
return errS3
|
||||
},
|
||||
})
|
||||
@@ -2611,7 +2624,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
@@ -2649,7 +2662,7 @@ func TestRebuildDedupeMockStoreDriver(t *testing.T) {
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn) error {
|
||||
WalkFn: func(ctx context.Context, path string, walkFn driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
||||
_ = walkFn(&FileInfoMock{
|
||||
IsDirFn: func() bool {
|
||||
return false
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
guuid "github.com/gofrs/uuid"
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/distribution/registry/storage/driver/factory"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver/factory"
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
@@ -67,8 +68,9 @@ func New(config *config.Config, linter common.Lint, metrics monitoring.MetricSer
|
||||
|
||||
return storeController, fmt.Errorf("storageDriver '%s' unsupported storage driver: %w", storeName, zerr.ErrBadConfig)
|
||||
}
|
||||
|
||||
// Init a Storager from connection string.
|
||||
store, err := factory.Create(storeName, config.Storage.StorageDriver)
|
||||
store, err := factory.Create(context.Background(), storeName, config.Storage.StorageDriver)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Str("rootDir", config.Storage.RootDirectory).Msg("failed to create s3 service")
|
||||
|
||||
@@ -183,7 +185,7 @@ func getSubStore(cfg *config.Config, subPaths map[string]config.StorageConfig,
|
||||
}
|
||||
|
||||
// Init a Storager from connection string.
|
||||
store, err := factory.Create(storeName, storageConfig.StorageDriver)
|
||||
store, err := factory.Create(context.Background(), storeName, storageConfig.StorageDriver)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Str("rootDir", storageConfig.RootDirectory).Msg("failed to create s3 service")
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ import (
|
||||
"time"
|
||||
|
||||
// Add s3 support.
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
"github.com/docker/distribution/registry/storage/driver/factory"
|
||||
_ "github.com/docker/distribution/registry/storage/driver/s3-aws"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver/factory"
|
||||
_ "github.com/distribution/distribution/v3/registry/storage/driver/s3-aws"
|
||||
guuid "github.com/gofrs/uuid"
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@@ -77,11 +77,12 @@ func createObjectsStore(rootDir string, cacheDir string) (
|
||||
"secretkey": "minioadmin",
|
||||
"secure": false,
|
||||
"skipverify": false,
|
||||
"forcepathstyle": true,
|
||||
}
|
||||
|
||||
storeName := fmt.Sprintf("%v", storageDriverParams["name"])
|
||||
|
||||
store, err := factory.Create(storeName, storageDriverParams)
|
||||
store, err := factory.Create(context.Background(), storeName, storageDriverParams)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
storagedriver "github.com/docker/distribution/registry/storage/driver"
|
||||
storagedriver "github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/distribution/registry/storage/driver"
|
||||
"github.com/distribution/distribution/v3/registry/storage/driver"
|
||||
)
|
||||
|
||||
type StorageDriverMock struct {
|
||||
@@ -152,7 +152,7 @@ func (f *FileWriterMock) Size() int64 {
|
||||
return int64(fileWriterSize)
|
||||
}
|
||||
|
||||
func (f *FileWriterMock) Cancel() error {
|
||||
func (f *FileWriterMock) Cancel(_ context.Context) error {
|
||||
if f != nil && f.CancelFn != nil {
|
||||
return f.CancelFn()
|
||||
}
|
||||
@@ -160,7 +160,7 @@ func (f *FileWriterMock) Cancel() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *FileWriterMock) Commit() error {
|
||||
func (f *FileWriterMock) Commit(_ context.Context) error {
|
||||
if f != nil && f.CommitFn != nil {
|
||||
return f.CommitFn()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user