Merge pull request #1286 from infosiftr/archFilter
Implement "archFilter" to fix arch-specific "Shared Tags" lists
This commit is contained in:
commit
35942faa57
|
|
@ -11,30 +11,28 @@ This template defines the "Supported tags and Dockerfile links" portion of an im
|
||||||
{{- "## Simple Tags\n\n" -}}
|
{{- "## Simple Tags\n\n" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- range $i, $e := $.Entries -}}
|
{{- range $i, $e := ($archSpecific | ternary (archFilter arch $.Entries) $.Entries) -}}
|
||||||
{{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
|
{{- $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 */ -}}
|
||||||
{{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
|
{{- $from := $.ArchDockerFrom $arch $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 -}}
|
||||||
|
|
||||||
{{- if $i -}}
|
{{- if $i -}}
|
||||||
{{- "\n" -}}
|
{{- "\n" -}}
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
- {{- "\t" -}}
|
|
||||||
{{- if $isGitHub -}} [ {{- end -}}
|
|
||||||
{{- $dir := .ArchDirectory $arch -}}
|
|
||||||
{{- $dockerfilePath := eq $dir "." | ternary "Dockerfile" (join "/" $dir "Dockerfile") -}}
|
|
||||||
` {{- $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 */ -}}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
- {{- "\t" -}}
|
||||||
|
{{- if $isGitHub -}} [ {{- end -}}
|
||||||
|
{{- $dir := .ArchDirectory $arch -}}
|
||||||
|
{{- $dockerfilePath := eq $dir "." | ternary "Dockerfile" (join "/" $dir "Dockerfile") -}}
|
||||||
|
` {{- $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 */ -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- "\n\n" -}}
|
{{- "\n\n" -}}
|
||||||
|
|
||||||
|
|
@ -42,13 +40,16 @@ This template defines the "Supported tags and Dockerfile links" portion of an im
|
||||||
{{- "## Shared Tags\n\n" -}}
|
{{- "## Shared Tags\n\n" -}}
|
||||||
|
|
||||||
{{- range $sharedTagGroups -}}
|
{{- range $sharedTagGroups -}}
|
||||||
{{- "-\t`" -}}
|
{{- $entries := $archSpecific | ternary (archFilter arch .Entries) .Entries -}}
|
||||||
{{ .SharedTags | join "`, `" }}
|
|
||||||
{{- "`:\n" -}}
|
{{- if (len $entries) -}}
|
||||||
{{- range $i, $e := .Entries -}}
|
{{- "-\t`" -}}
|
||||||
{{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
|
{{ .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 */ -}}
|
{{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
|
||||||
{{- $from := $.ArchDockerFrom $arch $e -}}
|
{{- $from := $.ArchDockerFrom $arch $e -}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,11 @@ fi
|
||||||
|
|
||||||
bashbrewFetchTemplate='
|
bashbrewFetchTemplate='
|
||||||
'"$templateHeader"'
|
'"$templateHeader"'
|
||||||
{{- range $i, $e := $.Entries -}}
|
{{- range $i, $e := ($archSpecific | ternary (archFilter arch $.Entries) $.Entries) -}}
|
||||||
'"$templateArchVar"'
|
'"$templateArchVar"'
|
||||||
{{- if $e.HasArchitecture $arch -}}
|
{{- join "/" "refs/tags" $arch $.RepoName ($e.Tags | first) -}}
|
||||||
{{- join "/" "refs/tags" $arch $.RepoName ($e.Tags | first) -}}
|
{{- ":" -}}
|
||||||
{{- ":" -}}
|
{{- "\n" -}}
|
||||||
{{- "\n" -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,9 @@ IFS=$'\n'
|
||||||
tags=( $(bashbrew cat -f '
|
tags=( $(bashbrew cat -f '
|
||||||
{{- $archSpecific := getenv "ARCH_SPECIFIC_DOCS" -}}
|
{{- $archSpecific := getenv "ARCH_SPECIFIC_DOCS" -}}
|
||||||
|
|
||||||
{{- range .Entries -}}
|
{{- range ($archSpecific | ternary (archFilter arch .Entries) .Entries) -}}
|
||||||
{{- $arch := $archSpecific | ternary arch (.HasArchitecture arch | ternary arch (.Architectures | first)) -}}
|
{{- join "\n" .Tags -}}
|
||||||
|
{{- "\n" -}}
|
||||||
{{- if .HasArchitecture $arch -}}
|
|
||||||
{{- join "\n" .Tags -}}
|
|
||||||
{{- "\n" -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
' "$repo") )
|
' "$repo") )
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue