Skip to content

Commit 73d8fba

Browse files
author
Prakash Surya
committed
Add "-b" to allowing downloading non-master image
This change extends the "download-latest-image" script to add the "-b" option which allows the user to specify which branch to use when downloading the upgrade image.
1 parent ca94ab8 commit 73d8fba

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# Copyright 2019 Delphix
3+
# Copyright 2019, 2020 Delphix
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ function die() {
2222

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

@@ -31,9 +31,11 @@ function cleanup() {
3131
}
3232

3333
opt_f=false
34-
while getopts ':f' c; do
34+
opt_b=master
35+
while getopts ':fb:' c; do
3536
case "$c" in
3637
f) eval "opt_$c=true" ;;
38+
b) eval "opt_$c=$OPTARG" ;;
3739
*) usage "illegal option -- $OPTARG" ;;
3840
esac
3941
done
@@ -53,7 +55,7 @@ $opt_f && rm -f "latest" >/dev/null 2>&1
5355
trap cleanup EXIT
5456

5557
aws s3 cp \
56-
"s3://snapshot-de-images/builds/jenkins-ops/devops-gate/master/appliance-build/master/post-push/latest" \
58+
"s3://snapshot-de-images/builds/jenkins-ops/devops-gate/master/appliance-build/$opt_b/post-push/latest" \
5759
. || die "failed to download file: 'latest'"
5860

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

0 commit comments

Comments
 (0)