2019-04-03 01:51:43 -05:00
|
|
|
#!/usr/bin/env bash
|
2023-04-04 11:17:12 -05:00
|
|
|
# Usage: ./verify-repos.sh [argument]
|
|
|
|
# argument is optional, but can be "beta" or a valid tag (ex: 9.4.7)
|
2020-10-13 12:27:03 -05:00
|
|
|
set -o pipefail
|
2020-03-19 11:53:55 -05:00
|
|
|
|
|
|
|
_basedir=$(dirname "$0")
|
2020-10-13 12:27:03 -05:00
|
|
|
cd "$_basedir" || exit
|
2019-04-03 01:51:43 -05:00
|
|
|
|
|
|
|
docker_build () {
|
|
|
|
dockerfile=$1
|
|
|
|
repo_file=$2
|
|
|
|
package=$3
|
|
|
|
tag=$4
|
|
|
|
|
2019-07-23 05:12:33 -05:00
|
|
|
docker build -f "$dockerfile" \
|
2019-04-03 01:51:43 -05:00
|
|
|
--build-arg "REPO_CONFIG=$repo_file" \
|
|
|
|
--build-arg "PACKAGE=$package" \
|
2019-07-23 05:12:33 -05:00
|
|
|
--tag "$tag" \
|
2019-04-03 01:51:43 -05:00
|
|
|
--no-cache \
|
|
|
|
.
|
|
|
|
|
2019-07-23 05:12:33 -05:00
|
|
|
retval=$(docker run --rm "$tag" cat /usr/share/grafana/VERSION)
|
2019-04-03 01:51:43 -05:00
|
|
|
}
|
|
|
|
|
2023-04-04 11:17:12 -05:00
|
|
|
_stable_or_beta="stable"
|
|
|
|
_grafana_deb_tag="grafana"
|
|
|
|
_grafana_rpm_tag="grafana"
|
|
|
|
_grafana_enterprise_deb_tag="grafana-enterprise"
|
|
|
|
_grafana_enterprise_rpm_tag="grafana-enterprise"
|
|
|
|
|
|
|
|
# CHECK_BETA=$1
|
|
|
|
if [[ $1 == "beta" ]]; then
|
|
|
|
_stable_or_beta="beta"
|
|
|
|
elif [[ $1 != "" ]]; then
|
|
|
|
# Assume user is passing in version
|
|
|
|
_version="$1"
|
|
|
|
_grafana_deb_tag="grafana=$_version"
|
|
|
|
_grafana_rpm_tag="grafana-$_version"
|
|
|
|
_grafana_enterprise_deb_tag="grafana-enterprise=$_version"
|
|
|
|
_grafana_enterprise_rpm_tag="grafana-enterprise-$_version"
|
|
|
|
fi
|
2019-04-03 01:51:43 -05:00
|
|
|
|
2023-04-04 11:17:12 -05:00
|
|
|
# Testing deb repos
|
|
|
|
docker_build "Dockerfile.deb" "deb-oss-$_stable_or_beta.list" "$_grafana_deb_tag" "gf-oss-deb-repo-test"
|
|
|
|
_oss_deb_v="$retval"
|
2019-04-03 01:51:43 -05:00
|
|
|
|
2023-04-04 11:17:12 -05:00
|
|
|
docker_build "Dockerfile.deb" "deb-ee-$_stable_or_beta.list" "$_grafana_enterprise_deb_tag" "gf-ee-deb-repo-test"
|
|
|
|
_ee_deb_v="$retval"
|
2019-04-03 01:51:43 -05:00
|
|
|
|
2023-04-04 11:17:12 -05:00
|
|
|
# Testing rpm repos
|
|
|
|
docker_build "Dockerfile.rpm" "rpm-oss-$_stable_or_beta.list" "$_grafana_rpm_tag" "gf-oss-rpm-repo-test"
|
|
|
|
_oss_rpm_v="$retval"
|
2019-04-03 01:51:43 -05:00
|
|
|
|
2023-04-04 11:17:12 -05:00
|
|
|
docker_build "Dockerfile.rpm" "rpm-ee-$_stable_or_beta.list" "$_grafana_enterprise_rpm_tag" "gf-ee-rpm-repo-test"
|
|
|
|
_ee_rpm_v="$retval"
|
2019-04-03 01:51:43 -05:00
|
|
|
|
|
|
|
echo Versions:
|
2019-07-23 05:12:33 -05:00
|
|
|
echo OSS deb = "${_oss_deb_v}"
|
|
|
|
echo OSS rpm = "${_oss_rpm_v}"
|
|
|
|
echo EE deb = "${_ee_deb_v}"
|
|
|
|
echo EE rpm = "${_ee_rpm_v}"
|