generate-dockerfile-links-partial.tmpl 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. {{- $froms := $.ArchDockerFroms $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. {{- $dockerfile := .ArchFile $arch -}}
  23. {{- $dockerfilePath := eq $dir "." | ternary $dockerfile (join "/" $dir $dockerfile) -}}
  24. ` {{- $e.Tags | join "`, `" -}} `
  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. {{- "\n\n" -}}
  30. {{- if (len $sharedTagGroups) -}}
  31. {{- "## Shared Tags\n\n" -}}
  32. {{- range $sharedTagGroups -}}
  33. {{- $entries := $archSpecific | ternary (archFilter arch .Entries) .Entries -}}
  34. {{- if (len $entries) -}}
  35. {{- "-\t`" -}}
  36. {{ .SharedTags | join "`, `" }}
  37. {{- "`:\n" -}}
  38. {{- range $i, $e := $entries -}}
  39. {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
  40. {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
  41. {{- $froms := $.ArchDockerFroms $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. {{- $dockerfile := .ArchFile $arch -}}
  49. {{- $dockerfilePath := eq $dir "." | ternary $dockerfile (join "/" $dir $dockerfile) -}}
  50. ` {{- $e.Tags | first -}} `
  51. {{- $gitCommit := $e.ArchGitCommit $arch -}}
  52. {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}}
  53. {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
  54. {{- "\n" -}}
  55. {{- end -}}
  56. {{- end -}}
  57. {{- end -}}
  58. {{- "\n" -}}
  59. {{- end -}}