Merge "Added PreMatching annotation to AuditLogContainerFilter"
[logging-analytics.git] / deploy / docker_prepull.sh
1 #!/bin/bash
2 #############################################################################
3 #
4 # Copyright © 2018 Amdocs.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #        http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 #############################################################################
18 # LOG-905
19 # the manifest is manually maintained and does not drive the image tags in values.yaml
20
21
22 usage() {
23 cat <<EOF
24 Usage: $0 [PARAMs]
25 example
26 sudo ./prepull_docker.sh -b casablanca -s nexus.onap.cloud:5000  -v true
27 -u                  : Display usage
28 -b [branch]         : branch = master or beijing or amsterdam or csablanca (required)
29 -s [server]         : server = IP or DNS name + port (required)
30 -v [true/false]     : validate
31 EOF
32 }
33
34 prepull() {
35   sudo curl https://git.onap.org/integration/plain/version-manifest/src/main/resources/docker-manifest.csv?h=$BRANCH > docker-manifest-$BRANCH.csv
36   # login twice - the first one periodically times out
37   sudo docker login -u docker -p docker $SERVER
38   sudo docker login -u docker -p docker $SERVER
39
40   # this line from Gary Wu
41   for IMAGE_TAG in $(tail -n +2 docker-manifest-$BRANCH.csv | tr ',' ':'); do
42     dt="$(date +"%T")"
43     echo "$dt: pulling $IMAGE_TAG"
44     sudo docker pull $SERVER/$IMAGE_TAG
45   done
46 }
47
48 BRANCH=
49 SERVER=nexus3.onap.org:10001
50 VALIDATE=false
51
52 while getopts ":b:s:v" PARAM; do
53   case $PARAM in
54     u)
55       usage
56       exit 1
57       ;;
58     b)
59       BRANCH=${OPTARG}
60       ;;
61     s)
62       SERVER=${OPTARG}
63       ;;
64     v)
65       VALIDATE=${OPTARG}
66       ;;
67     ?)
68       usage
69       exit
70       ;;
71     esac
72 done
73
74 if [[ -z $BRANCH ]]; then
75   usage
76   exit 1
77 fi
78
79 prepull $BRANCH $SERVER
80