MCPcopy Create free account
hub / github.com/containers/image / lookasideStorageBaseURL

Method lookasideStorageBaseURL

docker/registries_d.go:171–193  ·  view source on GitHub ↗

lookasideStorageBaseURL returns an appropriate signature storage URL for ref, for write access if “write”. the usage of the BaseURL is defined under docker/distribution registries—separate storage of docs/signature-protocols.md

(dr dockerReference, write bool)

Source from the content-addressed store, hash-verified

169// lookasideStorageBaseURL returns an appropriate signature storage URL for ref, for write access if “write”.
170// the usage of the BaseURL is defined under docker/distribution registries—separate storage of docs/signature-protocols.md
171func (config *registryConfiguration) lookasideStorageBaseURL(dr dockerReference, write bool) (*url.URL, error) {
172 topLevel := config.signatureTopLevel(dr, write)
173 var baseURL *url.URL
174 if topLevel != "" {
175 u, err := url.Parse(topLevel)
176 if err != nil {
177 return nil, fmt.Errorf("Invalid signature storage URL %s: %w", topLevel, err)
178 }
179 baseURL = u
180 } else {
181 // returns default directory if no lookaside specified in configuration file
182 baseURL = builtinDefaultLookasideStorageDir(rootless.GetRootlessEUID())
183 logrus.Debugf(" No signature storage configuration found for %s, using built-in default %s", dr.PolicyConfigurationIdentity(), baseURL.Redacted())
184 }
185 // NOTE: Keep this in sync with docs/signature-protocols.md!
186 // FIXME? Restrict to explicitly supported schemes?
187 repo := reference.Path(dr.ref) // Note that this is without a tag or digest.
188 if path.Clean(repo) != repo { // Coverage: This should not be reachable because /./ and /../ components are not valid in docker references
189 return nil, fmt.Errorf("Unexpected path elements in Docker reference %s for signature storage", dr.ref.String())
190 }
191 baseURL.Path = baseURL.Path + "/" + repo
192 return baseURL, nil
193}
194
195// builtinDefaultLookasideStorageDir returns default signature storage URL as per euid
196func builtinDefaultLookasideStorageDir(euid int) *url.URL {

Callers 2

SignatureStorageBaseURLFunction · 0.80
newDockerClientFromRefFunction · 0.80

Calls 6

signatureTopLevelMethod · 0.95
GetRootlessEUIDFunction · 0.92
PathFunction · 0.92
StringMethod · 0.65

Tested by

no test coverage detected