generate-dockerfile-links-partial.tmpl 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 := ($archSpecific | ternary (archFilter arch $.Entries) $.Entries) -}}
  10. {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
  11. {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
  12. {{- $from := $.ArchDockerFrom $arch $e -}}
  13. {{- $gitRepo := $e.ArchGitRepo $arch -}}
  14. {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
  15. {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}
  16. {{- if $i -}}
  17. {{- "\n" -}}
  18. {{- end -}}
  19. - {{- "\t" -}}
  20. {{- if $isGitHub -}} [ {{- end -}}
  21. {{- $dir := .ArchDirectory $arch -}}
  22. {{- $dockerfilePath := eq $dir "." | ternary "Dockerfile" (join "/" $dir "Dockerfile") -}}
  23. ` {{- $e.Tags | join "`, `" -}} ` (* {{- $dockerfilePath -}} *)
  24. {{- $gitCommit := $e.ArchGitCommit $arch -}}
  25. {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}}
  26. {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
  27. {{- end -}}
  28. {{- "\n\n" -}}
  29. {{- if (len $sharedTagGroups) -}}
  30. {{- "## Shared Tags\n\n" -}}
  31. {{- range $sharedTagGroups -}}
  32. {{- $entries := $archSpecific | ternary (archFilter arch .Entries) .Entries -}}
  33. {{- if (len $entries) -}}
  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. {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
  40. {{- $from := $.ArchDockerFrom $arch $e -}}
  41. {{- $gitRepo := $e.ArchGitRepo $arch -}}
  42. {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
  43. {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}
  44. {{- "\t-\t" -}}
  45. {{- if $isGitHub -}} [ {{- end -}}
  46. {{- $dir := .ArchDirectory $arch -}}
  47. {{- $dockerfilePath := ternary "Dockerfile" (join "/" $dir "Dockerfile") (eq $dir ".") -}}
  48. ` {{- $e.Tags | first -}} ` (* {{- $dockerfilePath -}} *)
  49. {{- $gitCommit := $e.ArchGitCommit $arch -}}
  50. {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}}
  51. {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
  52. {{- "\n" -}}
  53. {{- end -}}
  54. {{- end -}}
  55. {{- end -}}
  56. {{- "\n" -}}
  57. {{- end -}}