(output: Log, registry: string, namespace: string)
| 249 | } |
| 250 | |
| 251 | export function getCollectionRef(output: Log, registry: string, namespace: string): OCICollectionRef | undefined { |
| 252 | // Normalize input by downcasing entire string |
| 253 | registry = registry.toLowerCase(); |
| 254 | namespace = namespace.toLowerCase(); |
| 255 | |
| 256 | const path = namespace; |
| 257 | const resource = `${registry}/${path}`; |
| 258 | |
| 259 | output.write(`> Inputs: registry='${registry}' namespace='${namespace}'`, LogLevel.Trace); |
| 260 | output.write(`>`, LogLevel.Trace); |
| 261 | output.write(`> resource: ${resource}`, LogLevel.Trace); |
| 262 | |
| 263 | if (!regexForPath.exec(path)) { |
| 264 | output.write(`Parsed path '${path}' from input failed validation.`, LogLevel.Error); |
| 265 | return undefined; |
| 266 | } |
| 267 | |
| 268 | return { |
| 269 | registry, |
| 270 | path, |
| 271 | resource, |
| 272 | version: 'latest', |
| 273 | tag: 'latest', |
| 274 | }; |
| 275 | } |
| 276 | |
| 277 | // Validate if a manifest exists and is reachable about the declared feature/template. |
| 278 | // Specification: https://github.com/opencontainers/distribution-spec/blob/v1.0.1/spec.md#pulling-manifests |
no test coverage detected