-
Notifications
You must be signed in to change notification settings - Fork 29
/
tag_image.sh
executable file
·45 lines (39 loc) · 1.15 KB
/
tag_image.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
#!/usr/bin/env bash
set -e -o pipefail
SRC_TAG=$1
TARGET_TAG=$2
SAVEMODE=$3
logfile="docker.tagged.images.log"
echo "tag $SRC_TAG -> $TARGET_TAG"
if [[ $SRC_TAG == "" ]] || [[ $TARGET_TAG == "" ]] ; then
echo "ERROR: execute script like: tag_image.sh <src-tag> <target-tag> [--save]"
exit -1
fi
echo "" > $logfile
IMAGES=(
"consol/sakuli-ubuntu-xfce"
"consol/sakuli-ubuntu-xfce-java"
"consol/sakuli-ubuntu-icewm"
"consol/sakuli-ubuntu-icewm-java"
"consol/sakuli-centos-xfce"
"consol/sakuli-centos-xfce-java"
"consol/sakuli-centos-icewm"
"consol/sakuli-centos-icewm-java"
"consol/sakuli-ui"
)
#Loop
for IMAGE in "${IMAGES[@]}"; do
echo "IMAGE: $IMAGE:$SRC_TAG"
docker pull $IMAGE:$SRC_TAG
# skip test of sakuli UI image
if [[ $IMAGE != "consol/sakuli-ui" ]]; then
docker run -it -p 6911:6901 -e TESTSUITE_BROWSER=firefox $IMAGE:$SRC_TAG
docker run -it -p 6911:6901 -e TESTSUITE_BROWSER=chrome $IMAGE:$SRC_TAG
fi
docker tag $IMAGE:$SRC_TAG $IMAGE:$TARGET_TAG
if [[ "$SAVEMODE" != "--save" ]] ; then
docker push $IMAGE:$TARGET_TAG
fi
echo "$IMAGE:$SRC_TAG" >> $logfile
echo " - done!"
done