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
|
|
|
set -e
|
2017-04-27 22:58:43 +02:00
|
|
|
set -o pipefail
|
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
|
|
|
|
|
|
|
|
local resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/releases/latest")
|
2017-09-18 20:44:32 +02:00
|
|
|
local tag=$(echo $resp | jq -e --raw-output .tag_name)
|
|
|
|
local name=$(echo $resp | jq -e --raw-output .name)
|
2016-10-08 08:31:44 +02:00
|
|
|
|
|
|
|
if [[ "$tag" == "null" ]]; then
|
|
|
|
# get the latest tag
|
|
|
|
local resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/tags")
|
2017-09-18 20:44:32 +02:00
|
|
|
local 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"
|
2016-12-28 02:04:58 +01:00
|
|
|
elif [[ "$dir" == "SoftHSMv2" ]]; then
|
|
|
|
dir="golang-softhsm2"
|
2017-02-12 19:25:18 +01:00
|
|
|
elif [[ "$dir" == "bazel" ]]; then
|
|
|
|
dir="gitiles"
|
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"
|
2016-12-28 01:10:07 +01:00
|
|
|
fi
|
|
|
|
|
2016-10-08 08:31:44 +02:00
|
|
|
local current=$(cat "${dir}/Dockerfile" | grep -m 1 VERSION | awk '{print $(NF)}')
|
|
|
|
|
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"
|
|
|
|
|
2017-06-05 23:02:36 +02:00
|
|
|
if [[ "$tag" =~ "$current" ]] || [[ "$name" =~ "$current" ]] || [[ "$current" =~ "$tag" ]] || [[ "$current" == "master" ]]; then
|
2016-10-08 08:31:44 +02:00
|
|
|
echo -e "\e[36m${dir}:\e[39m current ${current} | ${tag} | ${name}"
|
|
|
|
else
|
2018-01-01 16:09:03 +01:00
|
|
|
# add to the bad versions
|
|
|
|
bad_versions+=( "${dir}" )
|
2018-03-18 23:59:50 +01:00
|
|
|
echo -e "\e[31m${dir}:\e[39m current ${current} | ${tag} | ${name} | ${releases}"
|
2016-10-08 08:31:44 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
projects=(
|
|
|
|
atom/atom
|
|
|
|
camlistore/camlistore
|
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
|
2018-02-14 19:03:55 +01:00
|
|
|
kubernetes-incubator/cri-o
|
2016-10-08 08:31:44 +02:00
|
|
|
curl/curl
|
2017-03-24 18:39:31 +01:00
|
|
|
google/guetzli
|
2016-10-08 08:31:44 +02:00
|
|
|
irssi/irssi
|
2017-06-11 02:30:01 +02:00
|
|
|
keepassxreboot/keepassxc
|
2016-12-28 02:04:58 +01:00
|
|
|
zyedidia/micro
|
2017-03-22 20:29:18 +01:00
|
|
|
bitly/oauth2_proxy
|
2018-03-11 17:50:58 +01:00
|
|
|
Tautulli/Tautulli
|
2016-10-08 08:31:44 +02:00
|
|
|
powershell/powershell
|
|
|
|
ricochet-im/ricochet
|
2016-12-28 02:04:58 +01:00
|
|
|
reverse-shell/routersploit
|
2016-10-08 08:31:44 +02:00
|
|
|
tarsnap/tarsnap
|
2016-12-28 02:04:58 +01:00
|
|
|
fcambus/telize
|
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
|
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() {
|
|
|
|
for p in ${projects[@]}; do
|
|
|
|
get_latest "$p"
|
|
|
|
done
|
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
|
|
|
|
echo "These Dockerfiles are not up to date: ${bad_versions[@]}" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-10-08 08:31:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|