From 9e826c1cb502282c9110ea6269f2ee72ec429fcd Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 20 Sep 2016 16:02:06 -0700 Subject: [PATCH] Add Jenkins "update.sh" badges to our docker-library repo README stubs for better community visibility --- generate-repo-stub-readme.sh | 39 +++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/generate-repo-stub-readme.sh b/generate-repo-stub-readme.sh index d9a686725292..a103ee428f8a 100755 --- a/generate-repo-stub-readme.sh +++ b/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 < /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