Skip to content

Commit c31b333

Browse files
author
Prakash Surya
committed
Add "-N" to allowing downloading nightly image
This change extends the "download-latest-image" script to add the "-N" option which allows the user to specify whether to download from the "nightly" build, or use the default "post-push" build.
1 parent 9dc9782 commit c31b333

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

files/common/usr/bin/download-latest-image

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function die() {
2222

2323
function usage() {
2424
echo "$(basename "$0"): $*" >&2
25-
echo "Usage: $(basename "$0") [-f] [-b branch] <variant>"
25+
echo "Usage: $(basename "$0") [-f] [-N] [-b branch] <variant>"
2626
exit 2
2727
}
2828

@@ -32,9 +32,10 @@ function cleanup() {
3232

3333
opt_f=false
3434
opt_b=master
35-
while getopts ':fb:' c; do
35+
opt_N=false
36+
while getopts ':fb:N' c; do
3637
case "$c" in
37-
f) eval "opt_$c=true" ;;
38+
f | N) eval "opt_$c=true" ;;
3839
b) eval "opt_$c=$OPTARG" ;;
3940
*) usage "illegal option -- $OPTARG" ;;
4041
esac
@@ -54,8 +55,18 @@ $opt_f && rm -f "latest" >/dev/null 2>&1
5455
#
5556
trap cleanup EXIT
5657

58+
#
59+
# The "-N" option allows the user to specify whether to download the
60+
# image from the "nightly" build, or use the default "post-push" build.
61+
#
62+
if $opt_N; then
63+
build=nightly
64+
else
65+
build=post-push
66+
fi
67+
5768
aws s3 cp \
58-
"s3://snapshot-de-images/builds/jenkins-ops/devops-gate/master/appliance-build/$opt_b/post-push/latest" \
69+
"s3://snapshot-de-images/builds/jenkins-ops/devops-gate/master/appliance-build/$opt_b/$build/latest" \
5970
. || die "failed to download file: 'latest'"
6071

6172
$opt_f && rm -f "$1.upgrade.tar" >/dev/null 2>&1

0 commit comments

Comments
 (0)