diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b4892e..fbe49fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### 0.9.1 (2020-02-20) + +* Minor amendments for the tag info page to account the cache type of sub-image. + ### 0.9.0 (2020-02-19) * Upgrade Go version to 1.13.7, alpine to 3.11 and other dependencies. diff --git a/README.md b/README.md index b11a75b..c9dbb37 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Docker image formats and their confusing combinations as supported by this UI: * Manifest v2 schema 1 + Manifest v2 schema 2: current format of a single image, the image history are coming from schema 1, should be referenced by repo:tag name. * Manifest v2 schema 1 + Manifest List v2 schema 2: multi-arch image format containing digests of sub-images, the image history are coming from schema 1 (no idea from what sub-image it was picked up when created), should be referenced by repo:tag name. * Manifest v2 schema 2: current image format referenced by its digest sha256, no image history. -* Manifest List v2 schema 2: multi-arch image format referenced by its digest sha256, no image history. +* Manifest List v2 schema 2: multi-arch image referenced by its digest sha256 or cache image referenced by tag name, no image history. ### Screenshots diff --git a/main.go b/main.go index 07a766b..c76183b 100644 --- a/main.go +++ b/main.go @@ -263,21 +263,26 @@ func (a *apiClient) viewTagInfo(c echo.Context) error { layersCount = len(gjson.Get(infoV1, "fsLayers").Array()) } - // Gather sub-image info of multi-arch image + // Gather sub-image info of multi-arch or cache image var digestList []map[string]interface{} for _, s := range manifests { r, _ := gjson.Parse(s.String()).Value().(map[string]interface{}) if s.Get("mediaType").String() == "application/vnd.docker.distribution.manifest.v2+json" { + // Sub-image of the specific arch. _, dInfoV1, _ := a.client.TagInfo(repoPath, s.Get("digest").String(), true) var dSize int64 for _, d := range gjson.Get(dInfoV1, "layers.#.size").Array() { dSize = dSize + d.Int() } r["size"] = dSize + // Create link here because there is a bug with jet template when referencing a value by map key in the "if" condition under "range". + if r["mediaType"] == "application/vnd.docker.distribution.manifest.v2+json" { + r["digest"] = fmt.Sprintf(`%s`, a.config.BasePath, namespace, repo, r["digest"], r["digest"]) + } } else { + // Sub-image of the cache type. r["size"] = s.Get("size").Int() } - delete(r, "mediaType") r["ordered_keys"] = registry.SortedMapKeys(r) digestList = append(digestList, r) } diff --git a/templates/tag_info.html b/templates/tag_info.html index 51faca8..718f3d9 100644 --- a/templates/tag_info.html +++ b/templates/tag_info.html @@ -20,12 +20,12 @@ - Image URL{{ registryHost }}/{{ repoPath }}{{if isDigest}}@{{else}}:{{end}}{{ tag }} + Image URL{{ registryHost }}/{{ repoPath }}{{ isDigest ? "@" : ":" }}{{ tag }} Digestsha256:{{ sha256 }} - {{if not isDigest}} + {{if created}} Created On{{ created|pretty_time }} @@ -48,7 +48,7 @@ {{if digestList}} -

Multi-arch Sub-images

+

Sub-images

{{range index, manifest := digestList}} @@ -68,10 +68,8 @@ {{else if key == "size"}} - {{else if key == "digest"}} - {{else}} - + {{end}} {{end}} diff --git a/version.go b/version.go index de8a634..c88f2bd 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -const version = "0.9.0" +const version = "0.9.1"
{{ manifest[key]|pretty_size }}{{ manifest["digest"] }}{{ manifest[key] }}{{ manifest[key]|raw }}