Function
fetchDockerTagDate
(
image: ImageRef,
tag: string,
opts: FetchOptions = {}
)
Source from the content-addressed store, hash-verified
| 533 | |
| 534 | /** Last push date of a Docker Hub tag (the "Docker API" freshness signal). */ |
| 535 | export async function fetchDockerTagDate( |
| 536 | image: ImageRef, |
| 537 | tag: string, |
| 538 | opts: FetchOptions = {} |
| 539 | ): Promise<string> { |
| 540 | if (image.registry !== "dockerhub") return ""; |
| 541 | const r = await fetchJSON<any>( |
| 542 | `https://hub.docker.com/v2/repositories/${image.name}/tags/${encodeURIComponent(tag)}`, |
| 543 | { ...opts, allow404: true } |
| 544 | ); |
| 545 | return iso(r?.last_updated ?? r?.tag_last_pushed); |
| 546 | } |
Tested by
no test coverage detected