-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpull.sh
executable file
·45 lines (40 loc) · 1.13 KB
/
pull.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
#!/bin/bash
######################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# SPDX-License-Identifier: MIT-0 #
######################################################################
source .env
function usage(){
echo ""
echo "Usage: $0 [arg] - pull one or more images from the configured registry"
echo ""
echo " arg:"
echo ""
echo " '' - pull the latest built image only"
echo " ls - list available images to pull"
echo " all - pull all project images"
echo " image - pull specified image only"
echo ""
}
if [ "$1" == "--help" ]; then
usage
exit 0
fi
if [ "$1" == "" ]; then
docker image push ${REGISTRY}${IMAGE}${TAG}
else
case "$1" in
"ls")
aws ecr describe-repositories | grep repositoryUri | grep $IMAGE_NAME | cut -d '"' -f 4
;;
"all")
IMAGES=$(aws ecr describe-repositories | grep repositoryUri | grep $IMAGE_NAME | cut -d '"' -f 4)
for IMG in $IMAGES; do
docker pull ${IMG}${TAG}
done
;;
*)
docker pull ${1}${TAG}
;;
esac
fi