Skip to content
Snippets Groups Projects

Introduce GCS adapter for remote cache

Merged Tomasz Maczukin requested to merge introduce-gcs-cache-support into master
1 unresolved thread
Compare and Show latest version
15 files
+ 598
388
Compare changes
  • Side-by-side
  • Inline
Files
15
+ 4
10
@@ -6,8 +6,6 @@ import (
"sync"
"time"
"github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitlab-runner/common"
)
@@ -57,20 +55,16 @@ func Factories() *adapterFactoriesMap {
return factories
}
func FactorizeAdapter(cacheConfig *common.CacheConfig, timeout time.Duration, objectName string) Adapter {
log := logrus.WithField("type", cacheConfig.Type)
func FactorizeAdapter(cacheConfig *common.CacheConfig, timeout time.Duration, objectName string) (Adapter, error) {
factorize, err := Factories().Find(cacheConfig.Type)
if err != nil {
log.WithError(err).Error("Cache factory not found")
return nil
return nil, fmt.Errorf("cache factory not found: %v", err)
}
adapter, err := factorize(cacheConfig, timeout, objectName)
if err != nil {
log.WithError(err).Error("Cache adapter could not be initialized")
return nil
return nil, fmt.Errorf("cache adapter could not be initialized: %v", err)
}
return adapter
return adapter, nil
}
Loading