Skip to content

Commit

Permalink
Script should not end terminal if not using bash (#5630)
Browse files Browse the repository at this point in the history
* Script should not end terminal if not using bash

If the user hit the exit 0 (when using source) and
they did not use bash  terminal would exit.
The user would not know why the terminal exited.

Updated script to just check to see if there is bash available.

Set namespace to default if not specified

Add additional instructions when not running in bash

Document the use of the --namespace key

namespace is no longer positional but requires a --namespace or -ns key

* Update set-ver.sh

Make scdf the default namespace
[skip ci]
---------

Co-authored-by: Corneil du Plessis <[email protected]>
  • Loading branch information
cppwfs and corneil authored Jan 3, 2024
1 parent 3790ad9 commit 15a2178
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Since these scripts export environmental variable they need to be executes as in

[source,shell]
....
source ./k8s/use-mk-docker.sh test-ns postgresql rabbitmq
source ./k8s/use-mk-docker.sh postgresql rabbitmq --namespace test-ns
....

===== TMC or GKE Cluster in Cloud
Expand Down
3 changes: 3 additions & 0 deletions src/deploy/k8s/set-ver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ while [ "$1" != "" ]; do
shift
done
echo "Namespace: $NS"
if [ "$NS" = "" ]; then
NS=scdf
fi
export NS
if [ "$BROKER" != "" ]; then
echo "BROKER: $BROKER"
Expand Down
18 changes: 7 additions & 11 deletions src/deploy/k8s/use-mk-docker.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/usr/bin/env bash
(return 0 2>/dev/null) && sourced=1 || sourced=0
if [ "$sourced" = "0" ]; then
echo "This script must be invoked using: source $0 $*"
exit 1
fi
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 0
echo "This script requires Bash. For example:\n bash \n $0 $*"
else
echo "Setting variables"
SCDIR=$(readlink -f "${BASH_SOURCE[0]}")
SCDIR=$(dirname "$SCDIR")
SCDIR=$(realpath $SCDIR)
source $SCDIR/use-mk.sh docker $*
fi
SCDIR=$(readlink -f "${BASH_SOURCE[0]}")
SCDIR=$(dirname "$SCDIR")
SCDIR=$(realpath $SCDIR)
source $SCDIR/use-mk.sh docker $*

0 comments on commit 15a2178

Please sign in to comment.