This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpush_beta_to_latest.sh
executable file
·55 lines (46 loc) · 1.71 KB
/
push_beta_to_latest.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
#!/bin/bash
# © Copyright 2020-2020 UCAR
# This software is licensed under the terms of the Apache Licence Version 2.0 which can be obtained at
# http://www.apache.org/licenses/LICENSE-2.0.
#
# push_beta_to_latest.sh - Make test version of Docker image the latest on Docker Hub
#
# Useage:
# push_beta_to_latest.sh <name> <tag>
#
# <name> - name of image to build in format <compiler>-<mpi>-<type>
# where <type> is dev (development) or app (application)
# Default: gnu-openmpi-dev
#
# <tag> - optional tag for input docker image (default beta)
#
#------------------------------------------------------------------------
function get_ans {
ans=''
while [[ $ans != y ]] && [[ $ans != n ]]; do
echo $1
read ans < /dev/stdin
if [[ $ans != y ]] && [[ $ans != n ]]; then echo "You must enter y or n"; fi
done
}
#------------------------------------------------------------------------
if [[ $# -lt 1 ]]; then
echo "usage: push_beta_to_latest <name> [<tag>]"
exit 1
fi
CNAME=${1:-"gnu-openmpi-dev"}
TAG=${2:-"beta"}
#------------------------------------------------------------------------
get_ans "Push to Docker Hub and back up?"
if [[ $ans == y ]] ; then
# save previous image in case something goes wrong
docker pull jcsda/docker-$CNAME:latest
docker tag jcsda/docker-$CNAME:latest jcsda/docker-$CNAME:revert
docker push jcsda/docker-$CNAME:revert
docker rmi jcsda/docker-$CNAME:latest
# push new image and re-tag it with latest
docker tag jcsda/docker-$CNAME:${TAG} jcsda/docker-$CNAME:latest
docker rmi jcsda/docker-$CNAME:${TAG}
docker push jcsda/docker-$CNAME:latest
fi
#------------------------------------------------------------------------