Skip to content

Commit

Permalink
Check for bash interpreter because dash isn't 100% compatible. (#5556)
Browse files Browse the repository at this point in the history
  • Loading branch information
corneil authored Nov 21, 2023
1 parent 556658b commit 0a7f9fc
Show file tree
Hide file tree
Showing 77 changed files with 313 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
set +e
if [ "$PUSH" == "" ]; then
Expand Down
4 changes: 4 additions & 0 deletions build-docs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
pushd "$SCDIR" > /dev/null || exit
Expand Down
4 changes: 4 additions & 0 deletions create-carvel-package.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
if [ "$SCDF_TYPE" = "" ]; then
Expand Down
4 changes: 4 additions & 0 deletions spring-cloud-dataflow-package/set-package-version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 0
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
MVNW=$SCDIR/../mvnw
if [ "$PACKAGE_VERSION" = "" ]; then
Expand Down
4 changes: 4 additions & 0 deletions spring-cloud-skipper/local/create-container.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 0
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
ROOT_DIR=$(realpath $SCDIR/..)
Expand Down
4 changes: 4 additions & 0 deletions spring-cloud-skipper/local/download-app.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 0
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
ROOT_DIR=$(realpath $SCDIR/..)
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/add-local-registry-secret.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
function check_env() {
eval ev='$'$1
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/carvel-add-registry-secret.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
function check_env() {
eval ev='$'$1
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/carvel-deploy-package.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
function check_env() {
eval ev='$'$1
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/carvel-prepare-namespaces.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")

function check_env() {
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/carvel-use-template.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")

if [ "$SCDF_TYPE" = "" ]; then
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/configure-database.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
if [ "$DEBUG" == "true" ]; then
echo "DEBUG: configure-database.sh $*"
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/delete-scdf.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
function check_env() {
eval ev='$'$1
Expand Down
5 changes: 4 additions & 1 deletion src/deploy/carvel/deploy-local-broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ end="\033[0m"
function count_kind() {
jq --arg kind $1 --arg name $2 '.items | .[] | select(.kind == $kind) | .metadata | select(.name == $name) | .name' | grep -c -F "$2"
}

if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
if [ "$BROKER" = "" ]; then
echo "BROKER must be defined"
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/deploy-local-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
bold="\033[1m"
dim="\033[2m"
end="\033[0m"
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
start_time=$(date +%s)
if [ "$1" = "" ]; then
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/deploy-local-prometheus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
bold="\033[1m"
dim="\033[2m"
end="\033[0m"
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
start_time=$(date +%s)
K8S=$(realpath $SCDIR/../kubernetes)
Expand Down
5 changes: 4 additions & 1 deletion src/deploy/carvel/deploy-scdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ fi
check_env NS
check_env PACKAGE_VERSION
check_env SCDF_TYPE

if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
start_time=$(date +%s)
# the following names are your choice.
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/load-images.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
PROMETHEUS=$(yq ".scdf.feature.monitoring.prometheusRsocketProxy.enabled" ./scdf-values.yml)
if [ "$PROMETHEUS" == "null" ]; then
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/prepare-local-namespace.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")

function check_env() {
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/register-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
bold="\033[1m"
dim="\033[2m"
end="\033[0m"
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
start_time=$(date +%s)
function register_app() {
Expand Down
5 changes: 4 additions & 1 deletion src/deploy/carvel/setup-scdf-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ function check_env() {
function count_kind() {
jq --arg kind $1 --arg name $2 '.items | .[] | select(.kind == $kind) | .metadata | select(.name == $name) | .name' | grep -c -F "$2"
}

if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
start_time=$(date +%s)
# the following names are your choice.
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/start-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
bold="\033[1m"
dim="\033[2m"
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/carvel/update-scdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
bold="\033[1m"
dim="\033[2m"
end="\033[0m"
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
start_time=$(date +%s)
# the following names are your choice.
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/images/build-app-images.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
ROOTDIR=$(realpath "$SCDIR/../..")
set -e
Expand Down
8 changes: 6 additions & 2 deletions src/deploy/images/build-ctr-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
./mvnw -o -am -pl :spring-cloud-dataflow-composed-task-runner install -DskipTests -T 0.5C
./mvnw -o -pl :spring-cloud-dataflow-composed-task-runner spring-boot:build-image -DskipTests
$SCDIR/mvnw -o -am -pl :spring-cloud-dataflow-composed-task-runner install -DskipTests -T 0.5C
$SCDIR/mvnw -o -pl :spring-cloud-dataflow-composed-task-runner spring-boot:build-image -DskipTests
8 changes: 6 additions & 2 deletions src/deploy/images/build-dataflow-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
./mvnw -o -am -pl :spring-cloud-dataflow-server install -DskipTests -T 0.5C
./mvnw -o -pl :spring-cloud-dataflow-server spring-boot:build-image -DskipTests
$SCDIR/mvnw -o -am -pl :spring-cloud-dataflow-server install -DskipTests -T 0.5C
$SCDIR/mvnw -o -pl :spring-cloud-dataflow-server spring-boot:build-image -DskipTests
4 changes: 4 additions & 0 deletions src/deploy/images/build-grafana-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
PROJECT_DIR=$(realpath $SCDIR/../../..)
pushd $PROJECT_DIR || exit
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/images/build-scdf-pro-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
ROOTDIR=$(realpath $(pwd))
./mvnw -o -am -pl :spring-cloud-starter-dataflow-server install -DskipTests
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/images/build-skipper-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
./mvnw -T 0.5C -o -am -pl :spring-cloud-skipper-server install -DskipTests
./mvnw -o -pl :spring-cloud-skipper-server spring-boot:build-image -DskipTests
4 changes: 4 additions & 0 deletions src/deploy/images/build-skipper-pro-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
ROOTDIR=$(realpath $(pwd))
./mvnw -o -am -pl :spring-cloud-starter-dataflow-server install -DskipTests
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/images/build-ssb-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
./mvnw -o -am -pl :spring-cloud-dataflow-single-step-batch-job install -DskipTests -T 0.5C
./mvnw -o -pl :spring-cloud-dataflow-single-step-batch-job spring-boot:build-image -DskipTests
4 changes: 4 additions & 0 deletions src/deploy/k8s/configure-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if [ "$NS" = "" ]; then
exit 2
fi
start_time=$(date +%s)
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
set -e
if [ "$K8S_DRIVER" = "" ]; then
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/k8s/delete-scdf.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
$SCDIR/delete-k8s-ns.sh $NS

4 changes: 4 additions & 0 deletions src/deploy/k8s/deploy-scdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ if [ "$NS" = "" ]; then
echo "NS not defined" >&2
exit 0
fi
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
K8S=$(realpath $SCDIR/../kubernetes)
if [ ! -d "$K8S" ]; then
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/k8s/destroy-k8s.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
kubectl_pid=$(ps aux | grep 'kubectl' | grep 'port\-forward' | awk '{print $2}')
if [ "$kubectl_pid" != "" ]
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/k8s/export-http-url.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
PARENT=$(realpath "$SCDIR/../../..")
if [ "$DATAFLOW_IP" = "" ]; then
Expand Down
5 changes: 4 additions & 1 deletion src/deploy/k8s/forward-scdf.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
(return 0 2>/dev/null) && sourced=1 || sourced=0

if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 0
fi
FWSCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SC_PATH=$(realpath $FWSCDIR)
set -e
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/k8s/install-scdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ if [ "$NS" = "" ]; then
exit 2
fi
start_time=$(date +%s)
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
LS_DIR=$(realpath $SCDIR)
K8S_PATH="$LS_DIR/yaml"
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/k8s/load-images.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
case $BROKER in
"" | "kafka")
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/k8s/register-apps.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
set -e
function dataflow_post() {
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/k8s/setup-metallb.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if [ -z "$BASH_VERSION" ]; then
echo "This script requires Bash. Use: bash $0 $*"
exit 1
fi
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
echo "Deploying Metal LoadBalancer"
Expand Down
Loading

0 comments on commit 0a7f9fc

Please sign in to comment.