2018-07-26 06:40:52 -05:00
|
|
|
#!/bin/sh
|
2018-08-06 09:26:59 -05:00
|
|
|
set -e
|
2018-07-26 06:40:52 -05:00
|
|
|
|
2019-01-09 08:50:52 -06:00
|
|
|
_grafana_tag=${1:-}
|
|
|
|
_docker_repo=${2:-grafana/grafana}
|
2018-07-26 06:40:52 -05:00
|
|
|
|
2018-07-30 07:05:56 -05:00
|
|
|
# If the tag starts with v, treat this as a official release
|
|
|
|
if echo "$_grafana_tag" | grep -q "^v"; then
|
|
|
|
_grafana_version=$(echo "${_grafana_tag}" | cut -d "v" -f 2)
|
|
|
|
else
|
|
|
|
_grafana_version=$_grafana_tag
|
|
|
|
fi
|
|
|
|
|
2018-12-20 15:48:53 -06:00
|
|
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
|
|
|
|
2018-07-30 07:05:56 -05:00
|
|
|
echo "pushing ${_docker_repo}:${_grafana_version}"
|
2018-12-20 15:48:53 -06:00
|
|
|
|
|
|
|
|
|
|
|
docker_push_all () {
|
|
|
|
repo=$1
|
|
|
|
tag=$2
|
|
|
|
|
|
|
|
# Push each image individually
|
|
|
|
docker push "${repo}:${tag}"
|
|
|
|
docker push "${repo}-arm32v7-linux:${tag}"
|
|
|
|
docker push "${repo}-arm64v8-linux:${tag}"
|
|
|
|
|
|
|
|
# Create and push a multi-arch manifest
|
|
|
|
docker manifest create "${repo}:${tag}" \
|
|
|
|
"${repo}:${tag}" \
|
|
|
|
"${repo}-arm32v7-linux:${tag}" \
|
|
|
|
"${repo}-arm64v8-linux:${tag}"
|
|
|
|
|
|
|
|
docker manifest push "${repo}:${tag}"
|
|
|
|
}
|
|
|
|
|
2018-08-16 04:14:12 -05:00
|
|
|
if echo "$_grafana_tag" | grep -q "^v" && echo "$_grafana_tag" | grep -vq "beta"; then
|
2018-07-30 07:05:56 -05:00
|
|
|
echo "pushing ${_docker_repo}:latest"
|
2018-12-20 15:48:53 -06:00
|
|
|
docker_push_all "${_docker_repo}" "latest"
|
2019-01-09 08:50:52 -06:00
|
|
|
docker_push_all "${_docker_repo}" "${_grafana_version}"
|
|
|
|
elif echo "$_grafana_tag" | grep -q "^v" && echo "$_grafana_tag" | grep -q "beta"; then
|
|
|
|
docker_push_all "${_docker_repo}" "${_grafana_version}"
|
2018-08-16 04:14:12 -05:00
|
|
|
elif echo "$_grafana_tag" | grep -q "master"; then
|
2018-12-20 15:48:53 -06:00
|
|
|
docker_push_all "grafana/grafana" "master"
|
2019-01-09 08:50:52 -06:00
|
|
|
docker push "grafana/grafana-dev:${_grafana_version}"
|
2018-07-26 06:40:52 -05:00
|
|
|
fi
|