forked from grafana/mimir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush-images
executable file
·47 lines (39 loc) · 1020 Bytes
/
push-images
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
IMAGE_TAG=${IMAGE_TAG:-$(./tools/image-tag)}
usage() {
echo "$0"
exit 2
}
while [ $# -gt 0 ]; do
case "$1" in
*)
usage
exit 2
;;
esac
done
push_image() {
local image="$1"
echo "Pushing ${image}:${IMAGE_TAG}"
docker push "${image}:${IMAGE_TAG}"
# If image is the latest stable git tag, update the latest docker image tag.
# Do not tag with latest any release candidate (tag ends with "-rc.*").
if [[ "$(git tag | grep -E '^mimir-[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)" == "mimir-${IMAGE_TAG}" ]]; then
docker tag "${image}:${IMAGE_TAG}" "${image}:latest"
docker push "${image}:latest"
fi
}
# Push images
for image in $(make images); do
image_name=$(basename "$image")
case "$image_name" in
mimir-build-image)
# skip mimir-build-image
continue
;;
esac
push_image "${image}"
done