| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- {{- /*
- This template defines the "Supported tags and Dockerfile links" portion of an image description.
- */ -}}
- {{- $archSpecific := getenv "ARCH_SPECIFIC_DOCS" -}}
- {{- $sharedTagGroups := .Manifest.GetSharedTagGroups -}}
- {{- if (len $sharedTagGroups) -}}
- (See ["What's the difference between 'Shared' and 'Simple' tags?" in the FAQ](https://github.com/docker-library/faq#whats-the-difference-between-shared-and-simple-tags).)
- {{- "\n\n" -}}
- ## Simple Tags
- {{- "\n\n" -}}
- {{- end -}}
- {{- range $i, $e := ($archSpecific | ternary (archFilter arch $.Entries) $.Entries) -}}
- {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
- {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
- {{- $froms := $.ArchDockerFroms $arch $e -}}
- {{- $gitRepo := $e.ArchGitRepo $arch -}}
- {{- $gitCommit := $e.ArchGitCommit $arch -}}
- {{- $dir := .ArchDirectory $arch -}}
- {{- $dockerfile := .ArchFile $arch -}}
- {{- $dockerfilePath := eq $dir "." | ternary $dockerfile (join "/" $dir $dockerfile) -}}
- {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
- {{- $url := hasPrefix "https://github.com/" $repoUrlBase | ternary (join "/" $repoUrlBase "blob" $gitCommit $dockerfilePath) "" -}}
- {{- /* handle https://gitlab.../.../... style URLs (by reasonably assuming they're a gitlab instance) */ -}}
- {{- $url = $url | ternary $url (hasPrefix "https://gitlab." $repoUrlBase | ternary (join "/" $repoUrlBase "-/blob" $gitCommit $dockerfilePath) "") -}}
- {{- /* handle https://git.launchpad.net/ URLs */ -}}
- {{- $url = $url | ternary $url (hasPrefix "https://git.launchpad.net/" $repoUrlBase | ternary (print $repoUrlBase "/tree/" $dockerfilePath "?h=" ($e.ArchGitFetch $arch) "&id=" $gitCommit) "") -}}
- {{- /* TODO decide what to do (if anything) about other non-GitHub repos with respect to URL */ -}}
- {{- if $i -}}
- {{- "\n" -}}
- {{- end -}}
- - {{- "\t" -}}
- {{- if $url -}} [ {{- end -}}
- ` {{- $e.Tags | join "`, `" -}} `
- {{- if $url -}} ]( {{- $url -}} ) {{- end -}}
- {{- end -}}
- {{- "\n\n" -}}
- {{- if (len $sharedTagGroups) -}}
- {{- "## Shared Tags\n\n" -}}
- {{- range $sharedTagGroups -}}
- {{- $entries := $archSpecific | ternary (archFilter arch .Entries) .Entries -}}
- {{- if (len $entries) -}}
- {{- "-\t`" -}}
- {{ .SharedTags | join "`, `" }}
- {{- "`:\n" -}}
- {{- range $i, $e := $entries -}}
- {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
- {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
- {{- $froms := $.ArchDockerFroms $arch $e -}}
- {{- $gitRepo := $e.ArchGitRepo $arch -}}
- {{- $gitCommit := $e.ArchGitCommit $arch -}}
- {{- $dir := .ArchDirectory $arch -}}
- {{- $dockerfile := .ArchFile $arch -}}
- {{- $dockerfilePath := eq $dir "." | ternary $dockerfile (join "/" $dir $dockerfile) -}}
- {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
- {{- $url := hasPrefix "https://github.com/" $repoUrlBase | ternary (join "/" $repoUrlBase "blob" $gitCommit $dockerfilePath) "" -}}
- {{- /* handle https://gitlab.../.../... style URLs (by reasonably assuming they're a gitlab instance) */ -}}
- {{- $url = $url | ternary $url (hasPrefix "https://gitlab." $repoUrlBase | ternary (join "/" $repoUrlBase "-/blob" $gitCommit $dockerfilePath) "") -}}
- {{- /* handle https://git.launchpad.net/ URLs */ -}}
- {{- $url = $url | ternary $url (hasPrefix "https://git.launchpad.net/" $repoUrlBase | ternary (print $repoUrlBase "/tree/" $dockerfilePath "?h=" ($e.ArchGitFetch $arch) "&id=" $gitCommit) "") -}}
- {{- /* TODO decide what to do (if anything) about other non-GitHub repos with respect to URL */ -}}
- {{- "\t-\t" -}}
- {{- if $url -}} [ {{- end -}}
- ` {{- $e.Tags | first -}} `
- {{- if $url -}} ]( {{- $url -}} ) {{- end -}}
- {{- "\n" -}}
- {{- end -}}
- {{- end -}}
- {{- end -}}
- {{- "\n" -}}
- {{- end -}}
|