Преглед изворни кода

Add "Supported architectures" section

Tianon Gravi пре 8 година
родитељ
комит
c87c899907
3 измењених фајлова са 38 додато и 0 уклоњено
  1. 30 0
      .template-helpers/arches.sh
  2. 3 0
      .template-helpers/template.md
  3. 5 0
      update.sh

+ 30 - 0
.template-helpers/arches.sh

@@ -0,0 +1,30 @@
+#!/bin/bash
+set -Eeuo pipefail
+
+repo="${1:-}"
+if [ -z "$repo" ]; then
+	echo >&2 "usage: $0 repo"
+	echo >&2 "   ie: $0 hylang"
+	exit 1
+fi
+
+# if we haven't set BASHBREW_LIBRARY explicitly (like Jenkins does, for example), don't trust the local library
+if [ -z "${BASHBREW_LIBRARY:-}" ]; then
+	repo="https://github.com/docker-library/official-images/raw/master/library/$repo"
+fi
+
+bashbrew cat --format '
+	{{- range .Entries -}}
+		{{- range .Architectures -}}
+			{{- $ns := archNamespace . -}}
+			{{- if $ns -}}
+				[
+			{{- end -}}
+			`{{- . -}}`
+			{{- if $ns -}}
+				](https://hub.docker.com/r/{{- $ns -}}/{{- $.RepoName -}}/)
+			{{- end -}}
+			{{- ",\n" -}}
+		{{- end -}}
+	{{- end -}}
+' "$repo" | sort -u | tr '\n' ' ' | sed 's/, $/\n/'

+ 3 - 0
.template-helpers/template.md

@@ -13,6 +13,9 @@
 -	**Maintained by**:  
 	%%MAINTAINER%%
 
+-	**Supported architectures**: ([more info](https://github.com/docker-library/official-images#architectures-other-than-amd64))  
+	%%ARCHES%%
+
 -	**Published image artifact details**:  
 	[repo-info repo's `repos/%%REPO%%/` directory](https://github.com/docker-library/repo-info/blob/master/repos/%%REPO%%) ([history](https://github.com/docker-library/repo-info/commits/master/repos/%%REPO%%))  
 	(image metadata, transfer size, etc)

+ 5 - 0
update.sh

@@ -105,6 +105,11 @@ for image in "${images[@]}"; do
 		[ "$partial" ]
 		replace_field "$targetFile" 'TAGS' "$partial"
 
+		echo '  ARCHES => arches.sh "'"$repo"'"'
+		arches="$("$helperDir/arches.sh" "$repo")"
+		[ "$arches" ]
+		replace_field "$targetFile" 'ARCHES' "$arches"
+
 		echo '  CONTENT => '"$repo"'/content.md'
 		replace_field "$targetFile" 'CONTENT' "$(cat "$repo/content.md")"