Skip to content

Commit

Permalink
Change input parameters structure.
Browse files Browse the repository at this point in the history
Signed-off-by: Vittorio Cozzolino <vittorio.cozzolino@huawei.com>
  • Loading branch information
vcozzolino committed Oct 25, 2021
1 parent 5be5ff0 commit 7443521
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions examples/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,44 @@
# See the License for the specific language governing permissions and
# limitations under the License.


# Reset in case getopts has been used previously in the shell
OPTIND=1

usage()
{
echo ""
echo "Usage: $0 -t type -r repository"
echo -e "\t-t The type parameters allows to select which Sedna example to build (joint_inference, federated_learning, etc..).
It is possible to pass multiple folders by passing a list such as: \"dir_1 dir_2 .. \"."
echo "Usage: $0 -r repository incremental_learning ..."
echo -e "\t-r The repository parameters allows to select a private Docker repository to upload the images to."
echo -e "\tThe script expects a list of Sedna example to build (joint_inference, federated_learning, etc..).
It is possible to select multiple folders by providing a list such as: dir_1 dir_2 ...
If no input is provided, it will automayically build all available examples"
exit 1 # Exit script after printing help
}

while getopts "t:r:" opt
while getopts "r:" opt
do
case "$opt" in
t ) type=( "$OPTARG" ) ;;
r ) IMAGE_REPO="$OPTARG" ;;
? ) usage ;; # Print usage in case parameter is non-existent
esac
done

shift $((OPTIND-1))

[ "${1:-}" = "--" ] && shift

type=$@

if [ -z "$type" ]
then
echo "No example type specified, building all example images.."
echo "No example directories specified, building all example images.."
type="all"
fi

if [ -z "$IMAGE_REPO" ]
then
echo "Using default Docker hub..";
echo "Using default Docker hub";
IMAGE_REPO="kubeedge"
fi

Expand Down

0 comments on commit 7443521

Please sign in to comment.