From a20b1d523ed8502bf7403b2aa0dcc05517035338 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 5 Jul 2024 15:02:53 -0700 Subject: [PATCH 1/2] Apply a couple minor improvements/simplifications to `generate-dockerfile-links-partial.*` This creates no visible change in behavior (the `--arch-filter` flag to `bashbrew list` didn't exist at the time this was originally written, and it looks like our newline outputting behavior has changed over time such that it can now be simplified). --- .template-helpers/generate-dockerfile-links-partial.sh | 2 +- .template-helpers/generate-dockerfile-links-partial.tmpl | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.template-helpers/generate-dockerfile-links-partial.sh b/.template-helpers/generate-dockerfile-links-partial.sh index 3f0a1c91a..126fcbea3 100755 --- a/.template-helpers/generate-dockerfile-links-partial.sh +++ b/.template-helpers/generate-dockerfile-links-partial.sh @@ -13,7 +13,7 @@ if [ -z "${BASHBREW_LIBRARY:-}" ]; then repo="https://github.com/docker-library/official-images/raw/master/library/$repo" fi -if [ -n "$ARCH_SPECIFIC_DOCS" ] && archTags="$(bashbrew cat --format '{{ range .Entries }}{{ if .HasArchitecture arch }}{{ .Tags | first }}{{ "\n" }}{{ end }}{{ end }}' "$repo")" && [ -z "$archTags" ]; then +if [ -n "$ARCH_SPECIFIC_DOCS" ] && archTags="$(bashbrew list --uniq --arch-filter "$repo")" && [ -z "$archTags" ]; then echo "**WARNING:** THIS IMAGE *IS NOT SUPPORTED* ON THE \`$BASHBREW_ARCH\` ARCHITECTURE" exit fi diff --git a/.template-helpers/generate-dockerfile-links-partial.tmpl b/.template-helpers/generate-dockerfile-links-partial.tmpl index 2889640fb..5edc9c17f 100644 --- a/.template-helpers/generate-dockerfile-links-partial.tmpl +++ b/.template-helpers/generate-dockerfile-links-partial.tmpl @@ -33,16 +33,14 @@ This template defines the "Supported tags and Dockerfile links" portion of an im {{- $url = $url | ternary $url (hasPrefix "https://git.launchpad.net/" $repoUrlBase | ternary (print $repoUrlBase "/tree/" $dockerfilePath "?h=" ($e.ArchGitFetch $arch) "&id=" $gitCommit) "") -}} {{- /* TODO decide what to do (if anything) about other non-GitHub repos with respect to URL */ -}} - {{- if $i -}} - {{- "\n" -}} - {{- end -}} - - {{- "\t" -}} {{- if $url -}} [ {{- end -}} ` {{- $e.Tags | join "`, `" -}} ` {{- if $url -}} ]( {{- $url -}} ) {{- end -}} + + {{- "\n" -}} {{- end -}} -{{- "\n\n" -}} +{{- "\n" -}} {{- if (len $sharedTagGroups) -}} {{- "## Shared Tags\n\n" -}} From 796319414b3bfc2a25583527dc4fcb02c39132ca Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 5 Jul 2024 15:10:49 -0700 Subject: [PATCH 2/2] Add newlines between tag groups so they get better line-spacing Especially with Docker Hub's new stylesheets, the tag listing is *really* compressed and hard to scan/read, especially on the really extreme examples like `tomcat`. This adjusts the line-spacing such that they should have a little more breathing room overall. --- .template-helpers/generate-dockerfile-links-partial.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.template-helpers/generate-dockerfile-links-partial.tmpl b/.template-helpers/generate-dockerfile-links-partial.tmpl index 5edc9c17f..64472167d 100644 --- a/.template-helpers/generate-dockerfile-links-partial.tmpl +++ b/.template-helpers/generate-dockerfile-links-partial.tmpl @@ -38,9 +38,8 @@ This template defines the "Supported tags and Dockerfile links" portion of an im ` {{- $e.Tags | join "`, `" -}} ` {{- if $url -}} ]( {{- $url -}} ) {{- end -}} - {{- "\n" -}} + {{- "\n\n" -}} {{- end -}} -{{- "\n" -}} {{- if (len $sharedTagGroups) -}} {{- "## Shared Tags\n\n" -}} @@ -51,7 +50,7 @@ This template defines the "Supported tags and Dockerfile links" portion of an im {{- if (len $entries) -}} {{- "-\t`" -}} {{ .SharedTags | join "`, `" }} - {{- "`:\n" -}} + {{- "`:\n\n" -}} {{- range $i, $e := $entries -}} {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}} @@ -79,6 +78,7 @@ This template defines the "Supported tags and Dockerfile links" portion of an im {{- "\n" -}} {{- end -}} + {{- "\n" -}} {{- end -}} {{- end -}} {{- "\n" -}}