Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions generate-repo-stub-readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that Travis doesn't actually return 404 for repos that aren't set up -- they return a valid SVG. Not sure how to resolve that, but it isn't a big deal for our current needs (since it's a problem we've already got).

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