Skip to content

Commit daad0f8

Browse files
authored
Merge pull request #697 from infosiftr/automated-update-badges
Add Jenkins "update.sh" badges to our docker-library repo README stubs for better community visibility
2 parents ba7cc98 + 9e826c1 commit daad0f8

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

generate-repo-stub-readme.sh

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ fi
1919
gitRepo='https://github.com/docker-library/docs'
2020
hubPage="https://registry.hub.docker.com/_/$repo/"
2121

22-
canonicalRepo="$(curl -fsSLI -o /dev/null -w '%{url_effective}\n' "https://github.com/docker-library/$repo")" # follow redirects (http://stackoverflow.com/a/3077316/433558)
22+
canonicalRepo="https://github.com/docker-library/$repo"
23+
if [ -s "$repo/github-repo" ]; then
24+
canonicalRepo="$(< "$repo/github-repo")"
25+
fi
26+
canonicalRepo="$(curl -fsSLI -o /dev/null -w '%{url_effective}\n' "$canonicalRepo")" # follow redirects (http://stackoverflow.com/a/3077316/433558)
2327
travisRepo="${canonicalRepo#*://github.com/}"
2428

2529
cat <<EOREADME
@@ -30,8 +34,37 @@ This is the Git repo of the Docker [official image](https://docs.docker.com/dock
3034
The full readme is generated over in [docker-library/docs]($gitRepo), specifically in [docker-library/docs/$repo]($gitRepo/tree/master/$repo).
3135
3236
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).
37+
EOREADME
38+
39+
badges=()
40+
41+
n=$'\n'
42+
t=$'\t'
3343

34-
[![Travis CI](https://img.shields.io/travis/$travisRepo/master.svg)](https://travis-ci.org/$travisRepo/branches)
44+
travisImage="https://img.shields.io/travis/$travisRepo/master.svg"
45+
if wget -q --spider "$travisImage" &> /dev/null; then
46+
travisLink="https://travis-ci.org/$travisRepo/branches"
47+
badges+=( "-${t}[Travis CI: ${n}${t}![build status badge]($travisImage)]($travisLink)" )
48+
fi
49+
50+
jenkinsImage="https://doi-janky.infosiftr.net/job/update.sh/job/$repo/badge/icon"
51+
if wget -q --spider "$jenkinsImage" &> /dev/null; then
52+
jenkinsLink="https://doi-janky.infosiftr.net/job/update.sh/job/$repo"
53+
badges+=( "-${t}[Automated \`update.sh\`: ${n}${t}![build status badge]($jenkinsImage)]($jenkinsLink)" )
54+
fi
55+
56+
if [ "${#badges[@]}" -gt 0 ]; then
57+
IFS=$'\n'
58+
cat <<-EOREADME
59+
60+
---
61+
62+
${badges[*]}
63+
EOREADME
64+
unset IFS
65+
fi
66+
67+
cat <<EOREADME
3568
36-
<!-- THIS FILE IS GENERATED BY https://github.com/docker-library/docs/blob/master/generate-repo-stub-readme.sh -->
69+
<!-- THIS FILE IS GENERATED BY $gitRepo/blob/master/generate-repo-stub-readme.sh -->
3770
EOREADME

0 commit comments

Comments
 (0)