generate-dockerfile-links-partial.tmpl 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {{- /*
  2. This template defines the "Supported tags and Dockerfile links" portion of an image description.
  3. */ -}}
  4. {{- $archSpecific := getenv "ARCH_SPECIFIC_DOCS" -}}
  5. {{- $sharedTagGroups := .Manifest.GetSharedTagGroups -}}
  6. {{- if (len $sharedTagGroups) -}}
  7. {{- "## Simple Tags\n\n" -}}
  8. {{- end -}}
  9. {{- range $i, $e := $.Entries -}}
  10. {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
  11. {{- if $e.HasArchitecture $arch -}}
  12. {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
  13. {{- $from := $.ArchDockerFrom $arch $e -}}
  14. {{- $gitRepo := $e.ArchGitRepo $arch -}}
  15. {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
  16. {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}
  17. {{- if $i -}}
  18. {{- "\n" -}}
  19. {{- end -}}
  20. - {{- "\t" -}}
  21. {{- if $isGitHub -}} [ {{- end -}}
  22. {{- $dir := .ArchDirectory $arch -}}
  23. {{- $dockerfilePath := ternary "Dockerfile" (join "/" $dir "Dockerfile") (eq $dir ".") -}}
  24. ` {{- $e.Tags | join "`, `" -}} ` (* {{- $dockerfilePath -}} *)
  25. {{- $gitCommit := $e.ArchGitCommit $arch -}}
  26. {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}}
  27. {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
  28. {{- end -}}
  29. {{- end -}}
  30. {{- "\n\n" -}}
  31. {{- if (len $sharedTagGroups) -}}
  32. {{- "## Shared Tags\n\n" -}}
  33. {{- range $sharedTagGroups -}}
  34. {{- "-\t`" -}}
  35. {{ .SharedTags | join "`, `" }}
  36. {{- "`:\n" -}}
  37. {{- range $i, $e := .Entries -}}
  38. {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
  39. {{- if $e.HasArchitecture $arch -}}
  40. {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
  41. {{- $from := $.ArchDockerFrom $arch $e -}}
  42. {{- $gitRepo := $e.ArchGitRepo $arch -}}
  43. {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
  44. {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}
  45. {{- "\t-\t" -}}
  46. {{- if $isGitHub -}} [ {{- end -}}
  47. {{- $dir := .ArchDirectory $arch -}}
  48. {{- $dockerfilePath := ternary "Dockerfile" (join "/" $dir "Dockerfile") (eq $dir ".") -}}
  49. ` {{- $e.Tags | first -}} ` (* {{- $dockerfilePath -}} *)
  50. {{- $gitCommit := $e.ArchGitCommit $arch -}}
  51. {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}}
  52. {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
  53. {{- "\n" -}}
  54. {{- end -}}
  55. {{- end -}}
  56. {{- end -}}
  57. {{- "\n" -}}
  58. {{- end -}}