From 48c7645a472fd699ea3b14e6a91a2ae4756225e5 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 13 Sep 2017 13:28:17 -0700 Subject: [PATCH] Add SharedTags information to "Supported tags" listing --- .../generate-dockerfile-links-partial.tmpl | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.template-helpers/generate-dockerfile-links-partial.tmpl b/.template-helpers/generate-dockerfile-links-partial.tmpl index 1501b727e..a7df00581 100644 --- a/.template-helpers/generate-dockerfile-links-partial.tmpl +++ b/.template-helpers/generate-dockerfile-links-partial.tmpl @@ -6,6 +6,42 @@ This template defines the "Supported tags and Dockerfile links" portion of an im {{- $archSpecific := getenv "ARCH_SPECIFIC_DOCS" -}} +{{- $sharedTagGroups := .Manifest.GetSharedTagGroups -}} +{{- if (len $sharedTagGroups) -}} + {{- "## Shared Tags\n\n" -}} + + {{- range $sharedTagGroups -}} + {{- "-\t`" -}} + {{ .SharedTags | join "`, `" }} + {{- "`:\n" -}} + {{- range $i, $e := .Entries -}} + {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}} + + {{- if $e.HasArchitecture $arch -}} + {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}} + {{- $from := $.ArchDockerFrom $arch $e -}} + + {{- $gitRepo := $e.ArchGitRepo $arch -}} + {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}} + {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}} + + {{- "\t-\t" -}} + {{- if $isGitHub -}} [ {{- end -}} + {{- $dir := .ArchDirectory $arch -}} + {{- $dockerfilePath := ternary "Dockerfile" (join "/" $dir "Dockerfile") (eq $dir ".") -}} + ` {{- $e.Tags | first -}} ` (* {{- $dockerfilePath -}} *) + {{- $gitCommit := $e.ArchGitCommit $arch -}} + {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}} + {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}} + + {{- "\n" -}} + {{- end -}} + {{- end -}} + {{- end -}} + + {{- "\n## Simple Tags\n\n" -}} +{{- end -}} + {{- range $i, $e := $.Entries -}} {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}