-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathpush-images.sh
executable file
·76 lines (66 loc) · 2.15 KB
/
push-images.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
#
# This file is part of MinIO DirectPV
# Copyright (c) 2023 MinIO, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This script pushes DirectPV and its sidecar images to private registry.
#
set -o errexit
set -o nounset
set -o pipefail
declare registry podman
function init() {
if [ "$#" -ne 1 ]; then
cat <<EOF
USAGE:
push-images.sh <REGISTRY>
ARGUMENT:
<REGISTRY> Image registry without 'http' prefix.
EXAMPLE:
$ push-images.sh example.org/myuser
EOF
exit 255
fi
registry="$1"
if which podman >/dev/null 2>&1; then
podman=podman
elif which docker >/dev/null 2>&1; then
podman=docker
else
echo "no podman or docker found; please install"
exit 255
fi
}
# usage: push_image <image>
function push_image() {
image="$1"
private_image="${image/quay.io\/minio/$registry}"
echo "Pushing image ${image}"
"${podman}" pull --quiet "${image}"
"${podman}" tag "${image}" "${private_image}"
"${podman}" push --quiet "${private_image}"
}
function main() {
push_image "quay.io/minio/csi-node-driver-registrar:v2.12.0-0"
push_image "quay.io/minio/csi-provisioner:v5.0.2-0"
push_image "quay.io/minio/csi-provisioner:v2.2.0-go1.18"
push_image "quay.io/minio/livenessprobe:v2.14.0-0"
push_image "quay.io/minio/csi-resizer:v1.12.0-0"
release=$(curl -sfL "https://api.github.com/repos/minio/directpv/releases/latest" | awk '/tag_name/ { print substr($2, 3, length($2)-4) }')
push_image "quay.io/minio/directpv:v${release}"
}
init "$@"
main "$@"