Skip to content

Commit

Permalink
feat: Add support for foreign layer caching (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmoel authored Aug 12, 2024
1 parent dafb5e2 commit 3e8bbfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nexus3/pkg/repository/docker/docker_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ func getTestDockerProxyRepository(name string) repository.DockerProxyRepository
HTTPSPort: tools.GetIntPointer(8643),
},
DockerProxy: repository.DockerProxy{
IndexType: repository.DockerProxyIndexTypeHub,
IndexType: repository.DockerProxyIndexTypeHub,
ForeignLayerUrlWhitelist: []string{},
},
}
}

func getTestProDockerProxyRepository(name string) repository.DockerProxyRepository {
cacheForeignLayers := true
return repository.DockerProxyRepository{
Name: name,
Online: true,
Expand Down Expand Up @@ -80,7 +82,9 @@ func getTestProDockerProxyRepository(name string) repository.DockerProxyReposito
Subdomain: tools.GetStringPointer(name),
},
DockerProxy: repository.DockerProxy{
IndexType: repository.DockerProxyIndexTypeHub,
IndexType: repository.DockerProxyIndexTypeHub,
CacheForeignLayers: &cacheForeignLayers,
ForeignLayerUrlWhitelist: []string{".*\\.docker\\.io"},
},
}
}
Expand Down
4 changes: 4 additions & 0 deletions nexus3/schema/repository/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ type DockerProxy struct {
IndexType DockerProxyIndexType `json:"indexType"`
// Url of Docker Index to use
IndexURL *string `json:"indexUrl,omitempty"`
// CacheForeignLayers: Allow Nexus Repository Manager to download and cache foreign layers
CacheForeignLayers *bool `json:"cacheForeignLayers,omitempty"`
// ForeignLayerUrlWhitelist is a list of regular expressions used to identify URLs that are allowed for foreign layer requests
ForeignLayerUrlWhitelist []string `json:"foreignLayerUrlWhitelist"`
}

// DockerHostedStorage contains repository storage for hosted docker
Expand Down

0 comments on commit 3e8bbfd

Please sign in to comment.