-
Notifications
You must be signed in to change notification settings - Fork 1
/
push.sh
executable file
·58 lines (47 loc) · 1.37 KB
/
push.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
#!/bin/bash
# WIP
# XXX: push images matching labels in releases.json
## Requires the following variables declared:
# DOCKER_DOMAIN=docker.io
# DOCKER_REPOSITORY=${DOCKER_DOMAIN}/<user>/babelfishpg
. .env
DEFAULT_DISTRO="ubuntu"
DEFAULT_OSVERSION="focal"
function push() {
docker tag babelfishpg:${BABELFISH_VERSION}-${DISTRO}.${OSVERSION} ${DOCKER_REPOSITORY}
docker push ${DOCKER_REPOSITORY}
}
function help() {
echo "
-T Babelfish tag, in the form of BABEL_2_1_1__PG_14_3 as eg. Mandatory.
-o Operating System. Default: ubuntu
-v Operating System version (eg. focal, bullseye, 8, etc.). Default: focal
"
}
while getopts 'o:v:T:M:hl' OPT
do
case "$OPT" in
o) DISTRO=$OPTARG ;;
v) OSVERSION=$OPTARG ;;
T) export TAG="$OPTARG" ;;
h|--help) help ;;
l) LATEST=" -t babelfishpg:latest " ;;
*) help ; exit 1 ;;
esac
done
if [ ! -v TAG ]
then
printf "TAG is a mandatory argument (-T).\n"
help
exit 2
fi
export DISTRO=${DISTRO:DEFAULT_DISTRO}
export OSVERSION=${OSVERSION:DEFAULT_OSVERSION}
export BABELFISH_VERSION=$(echo $TAG | sed -r -e 's/BABEL_([0-9a-z_]*)__PG.*/\1/' -e 's/_/./g')
if [ ! -f $BABELFISH_VERSION/$DISTRO/$OSVERSION/Dockerfile ]
then
printf "Dockerfile for that set of arguments does not exists, \n see ./render.sh"
exit 3
fi
docker login
push