mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-18 14:47:38 +01:00
Rename the adapter name of docker registry
Rename the adapter name of docker registry to "docker-registry" Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
bed60352bd
commit
30b5852b49
@ -20,16 +20,14 @@ import (
|
|||||||
"github.com/goharbor/harbor/src/replication/model"
|
"github.com/goharbor/harbor/src/replication/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
const registryTypeNative model.RegistryType = "native"
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := adp.RegisterFactory(registryTypeNative, func(registry *model.Registry) (adp.Adapter, error) {
|
if err := adp.RegisterFactory(model.RegistryTypeDockerRegistry, func(registry *model.Registry) (adp.Adapter, error) {
|
||||||
return newAdapter(registry)
|
return newAdapter(registry)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Errorf("failed to register factory for %s: %v", registryTypeNative, err)
|
log.Errorf("failed to register factory for %s: %v", model.RegistryTypeDockerRegistry, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Infof("the factory for adapter %s registered", registryTypeNative)
|
log.Infof("the factory for adapter %s registered", model.RegistryTypeDockerRegistry)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newAdapter(registry *model.Registry) (*native, error) {
|
func newAdapter(registry *model.Registry) (*native, error) {
|
||||||
@ -52,7 +50,7 @@ var _ adp.Adapter = native{}
|
|||||||
|
|
||||||
func (native) Info() (info *model.RegistryInfo, err error) {
|
func (native) Info() (info *model.RegistryInfo, err error) {
|
||||||
return &model.RegistryInfo{
|
return &model.RegistryInfo{
|
||||||
Type: registryTypeNative,
|
Type: model.RegistryTypeDockerRegistry,
|
||||||
SupportedResourceTypes: []model.ResourceType{
|
SupportedResourceTypes: []model.ResourceType{
|
||||||
model.ResourceTypeImage,
|
model.ResourceTypeImage,
|
||||||
},
|
},
|
||||||
|
@ -57,7 +57,7 @@ func Test_native_Info(t *testing.T) {
|
|||||||
var info, err = adapter.Info()
|
var info, err = adapter.Info()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.NotNil(t, info)
|
assert.NotNil(t, info)
|
||||||
assert.Equal(t, registryTypeNative, info.Type)
|
assert.Equal(t, model.RegistryTypeDockerRegistry, info.Type)
|
||||||
assert.Equal(t, 1, len(info.SupportedResourceTypes))
|
assert.Equal(t, 1, len(info.SupportedResourceTypes))
|
||||||
assert.Equal(t, 2, len(info.SupportedResourceFilters))
|
assert.Equal(t, 2, len(info.SupportedResourceFilters))
|
||||||
assert.Equal(t, 2, len(info.SupportedTriggers))
|
assert.Equal(t, 2, len(info.SupportedTriggers))
|
||||||
|
@ -65,7 +65,7 @@ func Test_native_FetchImages(t *testing.T) {
|
|||||||
fmt.Println("mockNativeRegistry URL: ", mock.URL)
|
fmt.Println("mockNativeRegistry URL: ", mock.URL)
|
||||||
|
|
||||||
var registry = &model.Registry{
|
var registry = &model.Registry{
|
||||||
Type: registryTypeNative,
|
Type: model.RegistryTypeDockerRegistry,
|
||||||
URL: mock.URL,
|
URL: mock.URL,
|
||||||
Insecure: true,
|
Insecure: true,
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@ import (
|
|||||||
|
|
||||||
// const definition
|
// const definition
|
||||||
const (
|
const (
|
||||||
// RegistryTypeHarbor indicates registry type harbor
|
|
||||||
RegistryTypeHarbor RegistryType = "harbor"
|
RegistryTypeHarbor RegistryType = "harbor"
|
||||||
RegistryTypeDockerHub RegistryType = "dockerHub"
|
RegistryTypeDockerHub RegistryType = "docker-hub"
|
||||||
RegistryTypeHuawei RegistryType = "Huawei"
|
RegistryTypeDockerRegistry RegistryType = "docker-registry"
|
||||||
|
RegistryTypeHuawei RegistryType = "huawei"
|
||||||
|
|
||||||
FilterStyleTypeText = "input"
|
FilterStyleTypeText = "input"
|
||||||
FilterStyleTypeRadio = "radio"
|
FilterStyleTypeRadio = "radio"
|
||||||
|
Loading…
Reference in New Issue
Block a user