Skip to content

Commit b03c7b7

Browse files
committed
Add Jenkins "update.sh" badges to our docker-library repo README stubs for better community visibility
1 parent 819dc2e commit b03c7b7

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

generate-repo-stub-readme.sh

Lines changed: 35 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,36 @@ 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'
3342

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

0 commit comments

Comments
 (0)