-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrebuild_all.sh
executable file
·146 lines (130 loc) · 4.71 KB
/
rebuild_all.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
# usage: ./rebuild_all.sh $(date -u +%Y%m%d) hysds master
BASE_PATH=$(dirname "${BASH_SOURCE}")
BASE_PATH=$(cd "${BASE_PATH}"; pwd)
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <yyyymmdd> <org> <branch>"
echo "e.g.: $0 20170620 hysds master"
exit 1
fi
REL_DATE=$1
ORG=$2
BRANCH=$3
# get uid and gid
ID=$(id -u)
GID=$(id -g)
echo "REL_DATE is $REL_DATE"
echo "ID is $ID"
echo "GID is $GID"
# pull latest docker.io centos, rabbitmq and elasticsearch
docker pull docker.io/elasticsearch:1.7 || exit 1
docker pull docker.io/rabbitmq:3-management || exit 1
docker pull docker.io/centos:7 || exit 1
docker tag docker.io/centos:7 docker.io/centos:latest || exit 1
# make temp workspace
TMP_DIR=$BASE_PATH/.tmp
rm -rf $TMP_DIR
mkdir $TMP_DIR
cd $TMP_DIR
# create artifacts directory
IMG_DIR=${BASE_PATH}/images
mkdir -p $IMG_DIR
# build hysds/base
echo "#############################"
echo "Building hysds/base"
echo "#############################"
git clone --single-branch -b ${BRANCH} https://github.com/${ORG}/puppet-hysds_base.git hysds_base
cd hysds_base
./build_docker.sh ${REL_DATE} ${ORG} ${BRANCH} || exit 1
docker tag hysds/base:${REL_DATE} hysds/base:latest || exit 1
docker tag hysds/cuda-base:${REL_DATE} hysds/cuda-base:latest || exit 1
docker push hysds/base:${REL_DATE} || exit 1
docker push hysds/cuda-base:${REL_DATE} || exit 1
docker push hysds/base:latest || exit 1
docker push hysds/cuda-base:latest || exit 1
cd ..
rm -rf hysds_base
# build hysds/dev
echo "#############################"
echo "Building hysds/dev"
echo "#############################"
git clone --single-branch -b ${BRANCH} https://github.com/${ORG}/puppet-hysds_dev.git hysds_dev
cd hysds_dev
./build_docker.sh ${REL_DATE} ${ORG} ${BRANCH} || exit 1
docker tag hysds/dev:${REL_DATE} hysds/dev:latest || exit 1
docker tag hysds/cuda-dev:${REL_DATE} hysds/cuda-dev:latest || exit 1
docker push hysds/dev:${REL_DATE} || exit 1
docker push hysds/cuda-dev:${REL_DATE} || exit 1
docker push hysds/dev:latest || exit 1
docker push hysds/cuda-dev:latest || exit 1
cd ..
rm -rf hysds_dev
cd $BASE_PATH
# hysds/redis
echo "#############################"
echo "Building hysds/redis"
echo "#############################"
docker build --rm --force-rm -t hysds/redis:${REL_DATE} -f Dockerfile.hysds-redis . || exit 1
docker tag hysds/redis:${REL_DATE} hysds/redis:latest || exit 1
docker push hysds/redis:${REL_DATE} || exit 1
docker push hysds/redis:latest || exit 1
# hysds/elasticsearch
echo "#############################"
echo "Building hysds/elasticsearch"
echo "#############################"
docker build --rm --force-rm -t hysds/elasticsearch:1.7 -f Dockerfile.hysds-elasticsearch . || exit 1
docker tag hysds/elasticsearch:1.7 hysds/elasticsearch:latest || exit 1
docker push hysds/elasticsearch:1.7 || exit 1
docker push hysds/elasticsearch:latest || exit 1
# hysds/rabbitmq
echo "#############################"
echo "Building hysds/rabbitmq"
echo "#############################"
docker build --rm --force-rm -t hysds/rabbitmq:3-management -f Dockerfile.hysds-rabbitmq . || exit 1
docker tag hysds/rabbitmq:3-management hysds/rabbitmq:latest || exit 1
docker push hysds/rabbitmq:3-management || exit 1
docker push hysds/rabbitmq:latest || exit 1
# build worker hysds components
echo "#######################################"
echo "Building hysds/pge-base and hysds/verdi"
echo "#######################################"
cd $TMP_DIR
git clone -b docker --single-branch https://github.com/${ORG}/puppet-verdi.git verdi
cd verdi
./build_docker.sh ${REL_DATE} || exit 1
cd ..
rm -rf verdi
cd $BASE_PATH
for i in verdi pge-base; do
docker tag hysds/${i}:${REL_DATE} hysds/${i}:latest || exit 1
docker push hysds/${i}:${REL_DATE} || exit 1
docker push hysds/${i}:latest || exit 1
if [ "$i" = "pge-base" ]; then
docker tag hysds/cuda-${i}:${REL_DATE} hysds/cuda-${i}:latest || exit 1
docker push hysds/cuda-${i}:${REL_DATE} || exit 1
docker push hysds/cuda-${i}:latest || exit 1
fi
done
# export verdi
cd $IMG_DIR
#docker save hysds/verdi:${REL_DATE} > hysds-verdi-${REL_DATE}.tar; echo "done saving"; pigz -f hysds-verdi-${REL_DATE}.tar
docker save hysds/verdi:latest > hysds-verdi-latest.tar; echo "done saving"; pigz -f hysds-verdi-latest.tar
cd -
# build hysds components
for i in mozart metrics grq cont_int; do
echo "#############################"
echo "Building hysds/$i"
echo "#############################"
cd $TMP_DIR
git clone -b docker --single-branch https://github.com/${ORG}/puppet-${i} ${i}
cd ${i}
./build_docker.sh ${REL_DATE} || exit 1
cd ..
rm -rf ${i}
cd $BASE_PATH
docker tag hysds/${i}:${REL_DATE} hysds/${i}:latest || exit 1
docker push hysds/${i}:${REL_DATE} || exit 1
docker push hysds/${i}:latest || exit 1
done
# clean temp dir
rm -rf $TMP_DIR