2016-10-08 08:31:44 +02:00
|
|
|
#!/bin/bash
|
2017-06-07 18:45:56 +02:00
|
|
|
# This script gets the latest GitHub releases for the specified projects.
|
2016-10-08 08:31:44 +02:00
|
|
|
|
|
|
|
if [[ -z "$GITHUB_TOKEN" ]]; then
|
|
|
|
echo "Set the GITHUB_TOKEN env variable."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
URI=https://api.github.com
|
|
|
|
API_VERSION=v3
|
|
|
|
API_HEADER="Accept: application/vnd.github.${API_VERSION}+json"
|
|
|
|
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
|
|
|
|
|
|
|
|
get_latest() {
|
|
|
|
local repo=$1
|
|
|
|
|
2018-09-25 01:17:06 +02:00
|
|
|
local resp
|
|
|
|
resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/releases")
|
|
|
|
local tag
|
2018-09-25 02:08:27 +02:00
|
|
|
tag=$(echo "$resp" | jq -e --raw-output .[0].tag_name)
|
2018-09-25 01:17:06 +02:00
|
|
|
local name
|
2018-09-25 02:08:27 +02:00
|
|
|
name=$(echo "$resp" | jq -e --raw-output .[0].name)
|
2016-10-08 08:31:44 +02:00
|
|
|
|
|
|
|
if [[ "$tag" == "null" ]]; then
|
|
|
|
# get the latest tag
|
2018-09-25 01:17:06 +02:00
|
|
|
resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/tags")
|
|
|
|
tag=$(echo "$resp" | jq -e --raw-output .[0].name)
|
2018-01-01 22:22:06 +01:00
|
|
|
tag=${tag#release-}
|
2016-10-08 08:31:44 +02:00
|
|
|
fi
|
|
|
|
|
2016-12-28 02:04:58 +01:00
|
|
|
if [[ "$name" == "null" ]] || [[ "$name" == "" ]]; then
|
2016-12-28 01:34:48 +01:00
|
|
|
name="-"
|
|
|
|
fi
|
|
|
|
|
2016-10-08 08:31:44 +02:00
|
|
|
local dir=${repo#*/}
|
2016-12-28 01:10:07 +01:00
|
|
|
|
|
|
|
if [[ "$dir" == "CouchPotatoServer" ]]; then
|
2016-12-28 02:04:58 +01:00
|
|
|
dir="couchpotato"
|
2018-02-14 19:03:55 +01:00
|
|
|
elif [[ "$dir" == "cri-o" ]]; then
|
|
|
|
dir="crio"
|
2018-03-06 20:35:50 +01:00
|
|
|
elif [[ "$dir" == "byte-unixbench" ]]; then
|
|
|
|
dir="unixbench"
|
2018-03-11 17:50:58 +01:00
|
|
|
elif [[ "$dir" == "Tautulli" ]]; then
|
|
|
|
dir="plexpy"
|
2018-01-01 16:09:03 +01:00
|
|
|
elif [[ "$dir" == "zookeeper" ]]; then
|
|
|
|
dir="zookeeper/3.5"
|
2017-03-22 20:29:18 +01:00
|
|
|
elif [[ "$dir" == "oauth2_proxy" ]]; then
|
|
|
|
dir="oauth2-proxy"
|
2018-09-24 19:10:57 +02:00
|
|
|
elif [[ "$dir" == "now-cli" ]]; then
|
|
|
|
dir="now"
|
2018-05-29 04:53:22 +02:00
|
|
|
elif [[ "$dir" == "wireguard" ]]; then
|
|
|
|
dir="wireguard/install"
|
2016-12-28 01:10:07 +01:00
|
|
|
fi
|
|
|
|
|
2018-03-24 00:34:06 +01:00
|
|
|
# Change to upper case for grep
|
2018-09-25 01:17:06 +02:00
|
|
|
local udir
|
|
|
|
udir=$(echo $dir | awk '{print toupper($0)}')
|
2018-03-24 00:34:06 +01:00
|
|
|
# Replace dashes (-) with underscores (_)
|
|
|
|
udir=${udir//-/_}
|
2018-03-24 00:44:03 +01:00
|
|
|
udir=${udir%/*}
|
2018-03-24 00:34:06 +01:00
|
|
|
|
|
|
|
local current
|
|
|
|
if [[ ! -d "$dir" ]]; then
|
|
|
|
# If the directory does not exist, then grep all for it
|
2018-09-25 01:17:06 +02:00
|
|
|
current=$(grep -m 1 "${udir}_VERSION" -- **/Dockerfile | head -n 1 | awk '{print $(NF)}')
|
2018-03-24 00:34:06 +01:00
|
|
|
else
|
2018-09-25 01:17:06 +02:00
|
|
|
current=$(grep -m 1 "${udir}_VERSION" "${dir}/Dockerfile" | awk '{print $(NF)}')
|
2018-03-24 00:34:06 +01:00
|
|
|
fi
|
|
|
|
|
2016-10-08 08:31:44 +02:00
|
|
|
|
2018-03-18 23:59:50 +01:00
|
|
|
compare "$name" "$dir" "$tag" "$current" "https://github.com/${repo}/releases"
|
|
|
|
}
|
|
|
|
|
|
|
|
get_latest_unifi() {
|
|
|
|
local latest current
|
|
|
|
latest=$(curl -sSL http://www.ubnt.com/downloads/unifi/debian/dists/cloudkey-stable/ubiquiti/binary-armhf/Packages \
|
|
|
|
| awk 'BEGIN {FS="\n"; RS="";} /^Package: unifi/' \
|
|
|
|
| awk '/^Version:/ {print $2}' \
|
|
|
|
| cut -d- -f1)
|
|
|
|
|
|
|
|
current=$(grep -m 1 UNIFI_VERSION unifi/Dockerfile | tr '"' ' ' | awk '{print $(NF)}')
|
|
|
|
|
|
|
|
compare unifi unifi "$latest" "$current" https://www.ubnt.com/download/unifi
|
|
|
|
}
|
|
|
|
|
|
|
|
compare() {
|
|
|
|
local name="$1" dir="$2" tag="$3" current="$4" releases="$5"
|
2018-09-24 19:26:26 +02:00
|
|
|
ignore_dirs=( "bazel" "bcc" "mc" "nzbget" "osquery" "powershell" "rstudio" )
|
2018-03-18 23:59:50 +01:00
|
|
|
|
2018-09-25 01:17:06 +02:00
|
|
|
if [[ "$tag" =~ $current ]] || [[ "$name" =~ $current ]] || [[ "$current" =~ $tag ]] || [[ "$current" == "master" ]]; then
|
|
|
|
echo -e "\\e[36m${dir}:\\e[39m current ${current} | ${tag} | ${name}"
|
2016-10-08 08:31:44 +02:00
|
|
|
else
|
2018-01-01 16:09:03 +01:00
|
|
|
# add to the bad versions
|
2018-09-25 01:17:06 +02:00
|
|
|
if [[ ! " ${ignore_dirs[*]} " =~ ${dir} ]]; then
|
2018-04-13 00:37:50 +02:00
|
|
|
bad_versions+=( "${dir}" )
|
|
|
|
fi
|
2018-09-25 01:17:06 +02:00
|
|
|
echo -e "\\e[31m${dir}:\\e[39m current ${current} | ${tag} | ${name} | ${releases}"
|
2016-10-08 08:31:44 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
projects=(
|
2018-06-18 17:21:20 +02:00
|
|
|
noelbundick/azure-cli-extension-noelbundick
|
2018-09-14 16:18:41 +02:00
|
|
|
iovisor/bcc
|
2018-07-15 02:56:49 +02:00
|
|
|
browsh-org/browsh
|
2017-01-06 02:31:45 +01:00
|
|
|
certbot/certbot
|
2016-12-28 02:04:58 +01:00
|
|
|
hashicorp/consul
|
2018-01-02 19:04:34 +01:00
|
|
|
coredns/coredns
|
2016-12-28 01:10:07 +01:00
|
|
|
CouchPotato/CouchPotatoServer
|
2016-10-08 08:31:44 +02:00
|
|
|
curl/curl
|
2018-07-22 02:02:26 +02:00
|
|
|
kolide/fleet
|
2018-06-18 19:00:20 +02:00
|
|
|
GoogleCloudPlatform/cloud-sdk-docker
|
2018-03-24 00:44:03 +01:00
|
|
|
google/gitiles
|
|
|
|
bazelbuild/bazel
|
2017-03-24 18:39:31 +01:00
|
|
|
google/guetzli
|
2016-10-08 08:31:44 +02:00
|
|
|
irssi/irssi
|
2018-03-24 00:34:06 +01:00
|
|
|
cryptodotis/irssi-otr
|
2017-06-11 02:30:01 +02:00
|
|
|
keepassxreboot/keepassxc
|
2018-07-14 01:23:01 +02:00
|
|
|
robertdavidgraham/masscan
|
2018-07-18 21:45:32 +02:00
|
|
|
MidnightCommander/mc
|
2016-12-28 02:04:58 +01:00
|
|
|
zyedidia/micro
|
2018-09-24 19:07:26 +02:00
|
|
|
zeit/now-cli
|
2018-07-15 00:05:06 +02:00
|
|
|
nzbget/nzbget
|
2017-03-22 20:29:18 +01:00
|
|
|
bitly/oauth2_proxy
|
2018-07-22 00:11:52 +02:00
|
|
|
facebook/osquery
|
2018-10-12 19:19:24 +02:00
|
|
|
hashicorp/packer
|
2018-03-11 17:50:58 +01:00
|
|
|
Tautulli/Tautulli
|
2018-05-12 22:21:02 +02:00
|
|
|
perkeep/perkeep
|
2016-10-08 08:31:44 +02:00
|
|
|
powershell/powershell
|
2018-07-14 23:53:05 +02:00
|
|
|
Radarr/Radarr
|
2018-06-23 23:14:05 +02:00
|
|
|
cesanta/docker_auth
|
2016-10-08 08:31:44 +02:00
|
|
|
ricochet-im/ricochet
|
2016-12-28 02:04:58 +01:00
|
|
|
reverse-shell/routersploit
|
2018-03-24 00:52:30 +01:00
|
|
|
rstudio/rstudio
|
2016-10-08 08:31:44 +02:00
|
|
|
tarsnap/tarsnap
|
2018-03-24 00:52:30 +01:00
|
|
|
fcambus/telize
|
2018-03-23 22:14:50 +01:00
|
|
|
nginx/nginx
|
2018-03-24 00:34:06 +01:00
|
|
|
simplresty/ngx_devel_kit
|
|
|
|
openresty/lua-nginx-module
|
|
|
|
leev/ngx_http_geoip2_module
|
|
|
|
maxmind/libmaxminddb
|
2017-11-29 22:24:29 +01:00
|
|
|
hashicorp/terraform
|
2018-03-06 20:35:50 +01:00
|
|
|
kdlucas/byte-unixbench
|
2016-12-28 02:04:58 +01:00
|
|
|
mitchellh/vagrant
|
|
|
|
hashicorp/vault
|
2018-06-23 21:38:35 +02:00
|
|
|
v2tec/watchtower
|
2017-06-11 02:30:01 +02:00
|
|
|
wireguard/wireguard
|
2016-10-08 08:31:44 +02:00
|
|
|
znc/znc
|
2016-12-28 02:04:58 +01:00
|
|
|
apache/zookeeper
|
2016-10-08 08:31:44 +02:00
|
|
|
)
|
|
|
|
|
2018-03-18 23:59:50 +01:00
|
|
|
other_projects=(
|
|
|
|
unifi
|
|
|
|
)
|
|
|
|
|
2017-06-05 23:02:36 +02:00
|
|
|
bad_versions=()
|
|
|
|
|
2016-10-08 08:31:44 +02:00
|
|
|
main() {
|
2018-09-25 01:17:06 +02:00
|
|
|
# shellcheck disable=SC2068
|
2016-10-08 08:31:44 +02:00
|
|
|
for p in ${projects[@]}; do
|
|
|
|
get_latest "$p"
|
|
|
|
done
|
2018-09-25 01:17:06 +02:00
|
|
|
# shellcheck disable=SC2068
|
2018-03-18 23:59:50 +01:00
|
|
|
for p in ${other_projects[@]}; do
|
|
|
|
get_latest_"$p"
|
|
|
|
done
|
2017-06-05 23:02:36 +02:00
|
|
|
|
|
|
|
if [[ ${#bad_versions[@]} -ne 0 ]]; then
|
|
|
|
echo
|
2018-09-25 01:17:06 +02:00
|
|
|
echo "These Dockerfiles are not up to date: ${bad_versions[*]}" >&2
|
2017-06-05 23:02:36 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2016-10-08 08:31:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|