Update Dockerfile links to use the first arch of an entry if amd64 isn't supported (brings back windows-amd64-only entries)

This commit is contained in:
Tianon Gravi 2017-06-20 10:29:53 -07:00
parent 6baae018c3
commit 13f8bd0859
1 changed files with 9 additions and 15 deletions

View File

@ -4,21 +4,13 @@ This template defines the "Supported tags and Dockerfile links" portion of an im
*/ -}} */ -}}
{{- define "dockerfilePath" -}}
{{- $dir := .ArchDirectory arch -}}
{{- if ne $dir "." -}}
{{- $dir -}}
/
{{- end -}}
Dockerfile
{{- end -}}
{{- range $i, $e := $.Entries -}} {{- range $i, $e := $.Entries -}}
{{- if $e.HasArchitecture arch -}} {{- $arch := ternary (ternary arch ($e.Architectures | first) ($e.HasArchitecture arch)) arch (eq arch "amd64") -}}
{{- if $e.HasArchitecture $arch -}}
{{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}} {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
{{- $from := $.DockerFrom $e -}} {{- $from := $.ArchDockerFrom $arch $e -}}
{{- $gitRepo := $e.ArchGitRepo arch -}} {{- $gitRepo := $e.ArchGitRepo $arch -}}
{{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}} {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
{{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}} {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}
@ -28,9 +20,11 @@ This template defines the "Supported tags and Dockerfile links" portion of an im
- {{- "\t" -}} - {{- "\t" -}}
{{- if $isGitHub -}} [ {{- end -}} {{- if $isGitHub -}} [ {{- end -}}
` {{- $e.Tags | join "`, `" -}} ` (* {{- template "dockerfilePath" $e -}} *) {{- $dir := .ArchDirectory $arch -}}
{{- $gitCommit := $e.ArchGitCommit arch -}} {{- $dockerfilePath := ternary "Dockerfile" (join "/" $dir "Dockerfile") (eq $dir ".") -}}
{{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- template "dockerfilePath" $e -}} ) {{- end -}} ` {{- $e.Tags | join "`, `" -}} ` (* {{- $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 */ -}} {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}