Browse Source

Update build badges and improve "generate-repo-stub-readme.sh"

Especially to link to the new FAQ entry (https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what)
Tianon Gravi 6 năm trước cách đây
mục cha
commit
635c3577fc
3 tập tin đã thay đổi với 47 bổ sung35 xóa
  1. 15 8
      README.md
  2. 30 26
      generate-repo-stub-readme.sh
  3. 2 1
      update.sh

+ 15 - 8
README.md

@@ -1,13 +1,20 @@
 # What is this?
 
-This repository contains the docs for each of the Docker official images. See [docker-library/official-images](https://github.com/docker-library/official-images) for the configuration how the images are built. To see all of the official images go to the [hub](https://hub.docker.com/explore/).
-
-All Markdown files here are run through [tianon's fork of `markdownfmt`](https://github.com/tianon/markdownfmt) (only forked to add some smaller-diff preference and minor DockerHub-compatibility changes), and verified as formatted correctly via Travis-CI.
-
--	[Travis CI:  
-	![build status badge](https://travis-ci.org/docker-library/docs.svg?branch=master)](https://travis-ci.org/docker-library/docs)
--	[Automated `update.sh` and `push.sh`:  
-	![build status badge](https://doi-janky.infosiftr.net/job/docs/job/update/badge/icon)](https://doi-janky.infosiftr.net/job/docs/job/update/)
+This repository contains the image documentation for each of the official images. See [docker-library/official-images](https://github.com/docker-library/official-images) for more information about the program in general.
+
+All Markdown files here are run through [tianon's fork of `markdownfmt`](https://github.com/tianon/markdownfmt) (only forked to add some smaller-diff preference and minor DockerHub-compatibility changes), and verified as formatted correctly via Travis CI.
+
+-	[![Travis CI status badge](https://img.shields.io/travis/docker-library/docs/master.svg?label=Travis%20CI)](https://travis-ci.org/docker-library/docs)
+-	[![library update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/library.svg?label=Automated%20library%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/library/)
+	-	[![amd64 update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/amd64.svg?label=Automated%20amd64%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/amd64/)
+	-	[![arm32v5 update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/arm32v5.svg?label=Automated%20arm32v5%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/arm32v5/)
+	-	[![arm32v6 update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/arm32v6.svg?label=Automated%20arm32v6%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/arm32v6/)
+	-	[![arm32v7 update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/arm32v7.svg?label=Automated%20arm32v7%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/arm32v7/)
+	-	[![arm64v8 update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/arm64v8.svg?label=Automated%20arm64v8%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/arm64v8/)
+	-	[![i386 update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/i386.svg?label=Automated%20i386%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/i386/)
+	-	[![ppc64le update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/ppc64le.svg?label=Automated%20ppc64le%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/ppc64le/)
+	-	[![s390x update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/s390x.svg?label=Automated%20s390x%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/s390x/)
+	-	[![windows-amd64 update.sh status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/docs/job/windows-amd64.svg?label=Automated%20windows-amd64%20update.sh)](https://doi-janky.infosiftr.net/job/docs/job/windows-amd64/)
 
 ## Table of Contents
 

+ 30 - 26
generate-repo-stub-readme.sh

@@ -45,15 +45,15 @@ cat <<EOREADME
 
 ## Maintained by: $maintainer
 
-This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [$repo]($hubPage) (not to be confused with any official $repo image provided by $repo upstream). See [the Docker Hub page]($hubPage) for the full readme on how to use this Docker image and for information regarding contributing and issues.
+This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [\`$repo\`]($hubPage) (not to be confused with any official \`$repo\` image provided by \`$repo\` upstream). See [the Docker Hub page]($hubPage) for the full readme on how to use this Docker image and for information regarding contributing and issues.
 
-The [full description from Docker Hub]($hubPage) is generated over in [docker-library/docs]($gitRepo), specifically in [docker-library/docs/$repo]($gitRepo/tree/master/$repo).
+The [full image description on Docker Hub]($hubPage) is generated/maintained over in [the docker-library/docs repository]($gitRepo), specifically in [the \`$repo\` directory]($gitRepo/tree/master/$repo).
 
 ## See a change merged here that doesn't show up on Docker Hub yet?
 
-Check [the "library/$repo" manifest file in the docker-library/official-images repo](https://github.com/docker-library/official-images/blob/master/library/$repo), especially [PRs with the "library/$repo" label on that repo](https://github.com/docker-library/official-images/labels/library%2F$repo).
+For more information about the full official images change lifecycle, see [the "An image's source changed in Git, now what?" FAQ entry](https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what).
 
-For more information about the official images process, see the [docker-library/official-images readme](https://github.com/docker-library/official-images/blob/master/README.md).
+For outstanding \`$repo\` image PRs, check [PRs with the "library/$repo" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2F$repo). For the current "source of truth" for [\`$repo\`]($hubPage), see [the \`library/$repo\` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/$repo).
 EOREADME
 
 badges=()
@@ -61,24 +61,25 @@ badges=()
 n=$'\n'
 t=$'\t'
 
-travisImage="https://img.shields.io/travis/$travisRepo/master.svg"
-if svg="$(wget -qO- "$travisImage" 2>/dev/null)" && [[ "$svg" != *unknown* ]]; then
-	travisLink="https://travis-ci.org/$travisRepo/branches"
-	badges+=( "-${t}[Travis CI:  ${n}${t}![build status badge]($travisImage)]($travisLink)" )
-fi
-
-# https://www.appveyor.com/docs/status-badges/#badges-for-projects-with-public-repositories-on-github-and-bitbucket
-appveyorImage="https://ci.appveyor.com/api/projects/status/github/docker-library/$repo?branch=master&svg=true"
-if svg="$(wget -qO- "$appveyorImage" 2>/dev/null)" && [[ "$svg" != *unknown* ]]; then
-	appveyorLink="https://ci.appveyor.com/project/docker-library/$repo"
-	badges+=( "-${t}[AppVeyor (Windows):  ${n}${t}![build status badge]($appveyorImage)]($appveyorLink)" )
-fi
-
-jenkinsImage="https://doi-janky.infosiftr.net/job/update.sh/job/$repo/badge/icon"
-if wget -q --spider "$jenkinsImage" &> /dev/null; then
-	jenkinsLink="https://doi-janky.infosiftr.net/job/update.sh/job/$repo"
-	badges+=( "-${t}[Automated \`update.sh\`:  ${n}${t}![build status badge]($jenkinsImage)]($jenkinsLink)" )
-fi
+toTest=(
+	"https://img.shields.io/travis/$travisRepo/master.svg?label=Travis%20CI" "https://travis-ci.org/$travisRepo/branches"
+	"https://img.shields.io/appveyor/ci/$travisRepo/master.svg?label=AppVeyor" "https://ci.appveyor.com/project/$travisRepo"
+	"https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/$repo.svg?label=Automated%20update.sh" "https://doi-janky.infosiftr.net/job/update.sh/job/$repo"
+)
+
+_check_shields_io_image() {
+	wget -qO- "$1" 2>/dev/null \
+		| grep -qvE 'unknown|invalid|access denied|not found'
+}
+
+set -- "${toTest[@]}"
+while [ "$#" -gt 0 ]; do
+	image="$1"; shift
+	url="$1"; shift
+	if _check_shields_io_image "$image"; then
+		badges+=( "-${t}[![build status badge]($image)]($url)" )
+	fi
+done
 
 arches="$(bashbrew cat --format '{{ range .Entries }}{{ join "\n" .Architectures }}{{ "\n" }}{{ end }}' "https://github.com/docker-library/official-images/raw/master/library/$repo" | sort -u)"
 if [ -n "$arches" ]; then
@@ -86,9 +87,9 @@ if [ -n "$arches" ]; then
 	i=0
 	for arch in $arches; do
 		jenkinsLink="https://doi-janky.infosiftr.net/job/multiarch/job/$arch/job/$repo"
-		jenkinsImage="$jenkinsLink/badge/icon"
-		if wget -q --spider "$jenkinsImage" &> /dev/null; then
-			archTable="${archTable:-|} [\`$arch\`<br />![build status badge]($jenkinsImage)]($jenkinsLink) |"
+		jenkinsImage="https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/$arch/job/$repo.svg?label=$arch"
+		if _check_shields_io_image "$jenkinsImage"; then
+			archTable="${archTable:-|} [![$arch build status badge]($jenkinsImage)]($jenkinsLink) |"
 			(( i = (i + 1) % 4 )) || : # modulo here needs to match the number of colums used below
 			if [ "$i" = 0 ]; then
 				archTable+="${n}|"
@@ -96,7 +97,10 @@ if [ -n "$arches" ]; then
 		fi
 	done
 	if [ -n "$archTable" ]; then
-		badges+=( "${n}| Build | Status | Badges | (per-arch) |${n}|:-:|:-:|:-:|:-:|${n}${archTable%${n}|}" )
+		if [ "${#badges[@]}" -gt 0 ]; then
+			badges+=( '' )
+		fi
+		badges+=( "| Build | Status | Badges | (per-arch) |${n}|:-:|:-:|:-:|:-:|${n}${archTable%${n}|}" )
 	fi
 fi
 

+ 2 - 1
update.sh

@@ -142,7 +142,8 @@ for image in "${images[@]}"; do
 			fi
 		elif [ -n "$ARCH_SPECIFIC_DOCS" ]; then
 			jenkinsJobUrl="https://doi-janky.infosiftr.net/job/multiarch/job/$BASHBREW_ARCH/job/$repo/"
-			partial+=$'\n\n''[![Build Status]('"${jenkinsJobUrl%/}"'/badge/icon) (`%%IMAGE%%` build job)]('"$jenkinsJobUrl"')'
+			jenkinsImageUrl="https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/$BASHBREW_ARCH/job/$repo.svg?label=%%IMAGE%%%20%20build%20job"
+			partial+=$'\n\n''[![%%IMAGE%% build status badge]('"$jenkinsImageUrl"')]('"$jenkinsJobUrl"')'
 		fi
 		replace_field "$targetFile" 'TAGS' "$partial"