#!/usr/bin/env bash # vim:ts=4:sts=4:sw=4:et # # Author: Hari Sekhon # Date: 2020-02-07 15:01:31 +0000 (Fri, 07 Feb 2020) # # https://github.com/harisekhon/bash-tools # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish # # https://www.linkedin.com/in/harisekhon # # Script to generate DOCKER_STATUS.md containing all DockerHub / Docker Cloud repo build statuses for a user on a single page # # Usage: # # without arguments generates a page containing statuses for all DockerHub repos for your $DOCKER_USER # # DOCKER_USER=harisekhon ./github_generate_status_docker.sh # # with arguments will only generate a page for those repos (repos will not be checked for existence but will get repo not found on the page itself) # # if not specifying the / prefix then auto prependeds $DOCKER_USER/ # # DOCKER_USER=harisekhon ./github_generate_status_page.sh harisekhon/hbase harisekhon/zookeeper harisekhon/nagios-plugins ... # # DOCKER_USER=harisekhon ./github_generate_status_page.sh hbase zookeeper nagios-plugins ... set -euo pipefail [ -n "${DEBUG:-}" ] && set -x srcdir="$(dirname "$0")" trap 'echo ERROR >&2' exit cd "$srcdir" file="DOCKER_STATUS.md" repolist="$*" # this leads to confusion as it generates some randomly unexpected output by querying a dockerhub user who happens to have the same name as your local user eg. hari, so force explicit now #USER="${DOCKER_USER:-${USERNAME:-${USER}}}" if [ -z "${DOCKER_USER:-}" ] ; then echo "\$DOCKER_USER not set!" exit 1 fi if [ -z "$repolist" ]; then repolist="$(dockerhub_search.py -n 100 harisekhon | awk '/^harisekhon\/.*[[:space:]]\[OK]/{print $1}' | sort)" fi num_repos="$(wc -l <<< "$repolist")" num_repos="${num_repos// /}" { cat <