Răsfoiți Sursa

Add Jenkins "update.sh" badges to our docker-library repo README stubs for better community visibility

Tianon Gravi 9 ani în urmă
părinte
comite
9e826c1cb5
1 a modificat fișierele cu 36 adăugiri și 3 ștergeri
  1. 36 3
      generate-repo-stub-readme.sh

+ 36 - 3
generate-repo-stub-readme.sh

@@ -19,7 +19,11 @@ fi
 gitRepo='https://github.com/docker-library/docs'
 hubPage="https://registry.hub.docker.com/_/$repo/"
 
-canonicalRepo="$(curl -fsSLI -o /dev/null -w '%{url_effective}\n' "https://github.com/docker-library/$repo")" # follow redirects (http://stackoverflow.com/a/3077316/433558)
+canonicalRepo="https://github.com/docker-library/$repo"
+if [ -s "$repo/github-repo" ]; then
+	canonicalRepo="$(< "$repo/github-repo")"
+fi
+canonicalRepo="$(curl -fsSLI -o /dev/null -w '%{url_effective}\n' "$canonicalRepo")" # follow redirects (http://stackoverflow.com/a/3077316/433558)
 travisRepo="${canonicalRepo#*://github.com/}"
 
 cat <<EOREADME
@@ -30,8 +34,37 @@ This is the Git repo of the Docker [official image](https://docs.docker.com/dock
 The full readme is generated over in [docker-library/docs]($gitRepo), specifically in [docker-library/docs/$repo]($gitRepo/tree/master/$repo).
 
 See a change merged here that doesn't show up on the 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 official images process, see the [docker-library/official-images readme](https://github.com/docker-library/official-images/blob/master/README.md).
+EOREADME
+
+badges=()
+
+n=$'\n'
+t=$'\t'
 
-[![Travis CI](https://img.shields.io/travis/$travisRepo/master.svg)](https://travis-ci.org/$travisRepo/branches)
+travisImage="https://img.shields.io/travis/$travisRepo/master.svg"
+if wget -q --spider "$travisImage" &> /dev/null; then
+	travisLink="https://travis-ci.org/$travisRepo/branches"
+	badges+=( "-${t}[Travis CI:  ${n}${t}![build status badge]($travisImage)]($travisLink)" )
+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
+
+if [ "${#badges[@]}" -gt 0 ]; then
+	IFS=$'\n'
+	cat <<-EOREADME
+
+		---
+
+		${badges[*]}
+	EOREADME
+	unset IFS
+fi
+
+cat <<EOREADME
 
-<!-- THIS FILE IS GENERATED BY https://github.com/docker-library/docs/blob/master/generate-repo-stub-readme.sh -->
+<!-- THIS FILE IS GENERATED BY $gitRepo/blob/master/generate-repo-stub-readme.sh -->
 EOREADME