Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit ebc1028

Browse files
author
Corneil du Plessis
authored
force bash (#437)
* [Scripts] Force bash
1 parent e1ac6a2 commit ebc1028

37 files changed

+127
-69
lines changed

performance-tests/README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This module contains code to create CF tasks that populate the SCDF database wit
55
The platform initialization relies on The acceptance test code to set up SCDF on CF, then run scripts to build and deploy the tasks from the corresponding Java apps:
66

77
```
8-
#!/usr/bin/env bash
8+
#!/usr/bin/bash
99
export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_URL=${bamboo.CLOUDFOUNDRY_URL}
1010
export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_ORG=${bamboo.CLOUDFOUNDRY_ORG}
1111
export SPRING_CLOUD_DEPLOYER_CLOUDFOUNDRY_SPACE=${bamboo.CLOUDFOUNDRY_SPACE}

performance-tests/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/bash
22

33
get_db_service_instance() {
44
service=$(cf services | grep p-dataflow-relational | awk '{print $1}')

performance-tests/initialize-cf-tile-streams.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/bash
22

33
. ./common.sh
44

performance-tests/initialize-cf-tile-tasks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/bash
22

33
. ./common.sh
44

scdf_cf_setup/import_uaa_certs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/bash
22
if [[ -z "$1" ]]; then
33
echo "No cert_host provided"
44
echo "Usage $0 cert_host"

scripts/at-cleanup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/bash
22
pushd $SETUP_TOOL_REPO > /dev/null
33
echo "PYTHONPATH=$PYTHONPATH"
44
echo "Cleanup CF environment"

src/local/README.adoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ You will need to install kubectl and then kind or minikube for a local cluster.
66

77
_How do I choose between minikube and kind? kind will generally provide quicker setup and teardown time than Minikube. There is little to choose in terms of performance between the 2 apart from being able to configure limits on CPUs and memory when deploying minikube. So in the case where you have memory constraints minikube will be a better option._
88

9+
=== macOS
10+
11+
Install realpath from https://ports.macports.org/port/realpath/[Macports] or `brew install realpath`
12+
13+
NOTE: The scripts have been developed for and tested on Bash.
14+
915
== Steps
1016
* Choose Kubernetes provider. Kind, Minikube or remote GKE or TMC
1117
* Decide the namespace to use for deployment if not `default`
@@ -35,6 +41,8 @@ Minikube uses one of a selection of drivers to provide a virtualization environm
3541
* https://minikube.sigs.k8s.io/docs/start/[Installation]
3642
* https://minikube.sigs.k8s.io/docs/start/#loadbalancer-deployments[LoadBalancer]
3743

44+
NOTE: Delete existing Minikube installation if you have any. `minikube delete`
45+
3846
=== Remote TMC Cluster
3947

4048
https://tanzu.vmware.com/mission-control[Tanzu Mission Control]
@@ -134,6 +142,18 @@ The following list of utilities may prove useful.
134142
| https://github.com/boz/kail[kail] | Extra and tail the logs of various pods based on various naming criteria.
135143
|===
136144

145+
=== `kail`
146+
147+
148+
* Using kail to log activity related to a specific stream.
149+
```shell
150+
kail --label=spring-group-id=<stream-name>
151+
```
152+
* Using kail to log all pods in specific namespace.
153+
```shell
154+
kail --ns=<namespace>
155+
```
156+
137157
== Scripts
138158

139159
[cols="5m,7"]

src/local/build-app-images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33

44
set -e

src/local/build-dataflow-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33
if [ "$DATAFLOW_VERSION" = "" ]; then
44
DATAFLOW_VERSION=2.10.0-SNAPSHOT

src/local/build-scdf-pro-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33
if [ "$SCDF_PRO_VERSION" = "" ]; then
44
SCDF_PRO_VERSION=1.5.0-SNAPSHOT

src/local/build-skipper-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33
if [ "$SKIPPER_VERSION" = "" ]; then
44
SKIPPER_VERSION=2.9.0-SNAPSHOT

src/local/configure-k8s.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
2+
3+
bold="\033[1m"
4+
dim="\033[2m"
5+
end="\033[0m"
6+
27
if [ "$NS" = "" ]; then
38
echo "NS not defined" >&2
49
exit 2
@@ -18,13 +23,13 @@ case "$K8S_DRIVER" in
1823
;;
1924
"gke")
2025
if [ "$GKE_CLUSTER" = "" ]; then
21-
echo "Cannot find environmental variable GKE_CLUSTER" >&2
26+
echo -e "${bold}Cannot find environmental variable GKE_CLUSTER${end}" >&2
2227
exit 2
2328
fi
2429
;;
2530
"tmc")
2631
if [ "$TMC_CLUSTER" = "" ]; then
27-
echo "Cannot find environmental variable TMC_CLUSTER" >&2
32+
echo -e "${bold}Cannot find environmental variable TMC_CLUSTER${end}" >&2
2833
exit 2
2934
fi
3035
if [ "$KUBECONFIG" = "" ]; then
@@ -36,7 +41,7 @@ case "$K8S_DRIVER" in
3641
echo "Creating Minikube cluster with $K8S_DRIVER"
3742
# K8S_DRIVER=kvm2, docker, vmware, virtualbox, podman, vmwarefusion or hyperkit
3843
minikube start --cpus=8 --memory=16g "--driver=$K8S_DRIVER" "--kubernetes-version=$K8S_VERSION"
39-
echo "Please run 'minikube tunnel' in a separate shell to ensure a LoadBalancer is active."
44+
echo -e "Please run ${bold}'minikube tunnel'${end} in a separate shell to ensure a LoadBalancer is active."
4045
;;
4146
esac
4247
COUNT=$(kubectl get namespaces | grep -c "$NS")
@@ -48,4 +53,4 @@ if [ "$K8S_DRIVER" = "kind" ]; then
4853
fi
4954
end_time=$(date +%s)
5055
elapsed=$((end_time - start_time))
51-
echo "Kubernetes on $K8S_DRIVER running in $elapsed seconds"
56+
echo -e "Kubernetes on $K8S_DRIVER running in ${bold}$elapsed${end} seconds"

src/local/delete-scdf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22

33
kubectl delete deployments --all $WAIT --namespace="$NS"
44
kubectl delete statefulsets --all $WAIT --namespace="$NS"

src/local/deploy-scdf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
if [ "$NS" = "" ]; then
33
echo "NS not defined" >&2
44
exit 0

src/local/destroy-k8s.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33
kubectl_pid=$(ps aux | grep 'kubectl' | grep 'port\-forward' | awk '{print $2}')
44
if [ "$kubectl_pid" != "" ]

src/local/export-dataflow-ip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
(return 0 2>/dev/null) && sourced=1 || sourced=0
33

44
if [ "$NS" = "" ]; then

src/local/export-http-url.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33
PARENT=$(realpath "$SCDIR/../../..")
44
if [ "$DATAFLOW_IP" = "" ]; then

src/local/forward-scdf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
(return 0 2>/dev/null) && sourced=1 || sourced=0
33

44
FWSCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")

src/local/install-scdf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
if [ "$NS" = "" ]; then
33
echo "NS not defined" >&2
44
exit 2

src/local/load-image.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
if [ "$K8S_DRIVER" = "" ]; then
33
K8S_DRIVER=kind
44
fi
55

66
set -e
77
if [ "$K8S_DRIVER" != "tmc" ] && [ "$K8S_DRIVER" != "gke" ] ; then
88
DONT_PULL=$3
9-
if [[ "$2" == "" ]]; then
9+
if [[ "$2" = "" ]]; then
1010
echo "A TAG is required for $1" >&2
1111
exit 2
1212
fi
@@ -61,7 +61,7 @@ if [ "$K8S_DRIVER" != "tmc" ] && [ "$K8S_DRIVER" != "gke" ] ; then
6161
for did in $DOCKER_IDS; do
6262
for mid in $MK_IDS; do
6363
# Docker id may be shorter than Minikube id.
64-
if [ "${mid:0:12}" == "${did:0:12}" ]; then
64+
if [ "${mid:0:12}" = "${did:0:12}" ]; then
6565
echo "$IMAGE already uploaded"
6666
exit 0
6767
fi

src/local/load-images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33
case $BROKER in
44
"" | "kafka")

src/local/local-k8s-test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env bash
2-
if [ "$1" == "-h" ]; then
1+
#!/bin/bash
2+
if [ "$1" = "-h" ]; then
33
echo "Usage $0 <test>"
44
echo " where test:"
55
echo " n for test-n-of-3"
@@ -12,11 +12,11 @@ SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
1212
pushd "$SCDIR/../../acceptance-tests/custom-apps/timestamp-batch-with-drivers-template1" > /dev/null
1313
./gradlew build install
1414
popd > /dev/null # This assumes you are using minikube with helm from bitnami and used release name scdf and executed forward-scdf.sh
15-
if [ "$DATAFLOW_IP" == "" ]; then
15+
if [ "$DATAFLOW_IP" = "" ]; then
1616
echo "DATAFLOW_IP not defined"
1717
exit 1
1818
fi
19-
if [ "$EXTRA" == "" ]; then
19+
if [ "$EXTRA" = "" ]; then
2020
export EXTRA="-P test-all"
2121
fi
2222
if [ "$1" != "" ]; then
@@ -42,7 +42,7 @@ if [ "$1" != "" ]; then
4242
esac
4343
fi
4444

45-
if [ "$BROKER" == "kafka" ]; then
45+
if [ "$BROKER" = "kafka" ]; then
4646
export BINDER=kafka
4747
else
4848
export BINDER=rabbit

src/local/pull-app-images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
set -e
33
docker pull springcloudstream/scdf-app-kitchen:1.0.0-SNAPSHOT
44
docker pull springcloudstream/scdf-app-customer:1.0.0-SNAPSHOT

src/local/pull-dataflow.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env bash
2-
if [ "$DATAFLOW_VERSION" == "" ]; then
1+
#!/bin/bash
2+
if [ "$DATAFLOW_VERSION" = "" ]; then
33
DATAFLOW_VERSION=2.10.0-SNAPSHOT
44
fi
55
docker pull "springcloud/spring-cloud-dataflow-server:$DATAFLOW_VERSION"

src/local/pull-scdf-pro.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
docker pull "dev.registry.pivotal.io/p-scdf-for-kubernetes/scdf-pro-repo/scdfpro.tanzu.vmware.com:1.5.0-SNAPSHOT"

src/local/pull-skipper.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env bash
2-
if [ "$SKIPPER_VERSION" == "" ]; then
1+
#!/bin/bash
2+
if [ "$SKIPPER_VERSION" = "" ]; then
33
SKIPPER_VERSION=2.9.0-SNAPSHOT
44
fi
55

src/local/register-apps.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33
set -e
44
function dataflow_post() {
@@ -16,11 +16,11 @@ function dataflow_post() {
1616
if [ "$1" != "" ]; then
1717
PLATFORM_TYPE=$1
1818
fi
19-
if [ "$PLATFORM_TYPE" == "" ]; then
19+
if [ "$PLATFORM_TYPE" = "" ]; then
2020
PLATFORM_TYPE=kubernetes
2121
fi
2222

23-
if [ "$DATAFLOW_IP" == "" ]; then
23+
if [ "$DATAFLOW_IP" = "" ]; then
2424
source "$SCDIR/export-dataflow-ip.sh"
2525
fi
2626
case $BROKER in
@@ -53,7 +53,7 @@ fi
5353

5454
echo "DATAFLOW_IP=$DATAFLOW_IP"
5555
dataflow_post "uri=https://repo.spring.io/$RELEASE_SNAPSHOT/org/springframework/cloud/stream/app/stream-applications-descriptor/$STREAM_APPS_VERSION/stream-applications-descriptor-$STREAM_APPS_VERSION.stream-apps-$BROKER_NAME-$TYPE" "$DATAFLOW_IP/apps"
56-
if [ "$TYPE" == "docker" ]; then
56+
if [ "$TYPE" = "docker" ]; then
5757
dataflow_post "uri=docker:springcloudtask/timestamp-task:2.0.2" "$DATAFLOW_IP/apps/task/timestamp/2.0.2"
5858
dataflow_post "uri=docker:springcloudtask/timestamp-batch-task:2.0.2" "$DATAFLOW_IP/apps/task/timestamp-batch/2.0.2"
5959
dataflow_post "uri=docker:springcloudtask/scenario-task:0.0.1-SNAPSHOT" "$DATAFLOW_IP/apps/task/scenario/0.0.1-SNAPSHOT"

src/local/setup-metallb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
33

44
echo "Deploying Metal LoadBalancer"

src/local/tmc/delete-cluster.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#!/usr/bin/env bash
2-
if [ "$TMC_CLUSTER" == "" ]; then
1+
#!/bin/bash
2+
if [ "$TMC_CLUSTER" = "" ]; then
33
echo "TMC_CLUSTER environmental variable not found" >&2
44
exit 2
55
fi
6-
if [ "$NS" == "" ]; then
6+
if [ "$NS" = "" ]; then
77
echo "NS not defined" >&2
88
exit 2
99
fi

src/local/tmc/set-cluster.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
# export TMC_CLUSTER=scdf-manual-empty-1654874129329054695
3-
if [ "$TMC_CLUSTER" == "" ]; then
3+
if [ "$TMC_CLUSTER" = "" ]; then
44
echo "Configure TMC_CLUSTER with the cluster name" >&2
55
exit 1
66
fi

src/local/use-gke.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
(return 0 2>/dev/null) && sourced=1 || sourced=0
3-
if [ "$sourced" == "0" ]; then
3+
if [ "$sourced" = "0" ]; then
44
echo "This script must be invoked using: source $0 $*"
55
exit 1
66
fi
77
function usage() {
88
echo "Usage $0 <cluster> [namespace]"
99
}
10-
if [ "$1" == "" ]; then
10+
if [ "$1" = "" ]; then
1111
usage
1212
return 1
1313
fi
@@ -21,12 +21,12 @@ export K8S_DRIVER=gke
2121
export GKE_CLUSTER="$1"
2222
echo "Connecting to $GKE_CLUSTER..."
2323
export REGION=$(gcloud container clusters list | grep -F "$CLUSTER_NAME" | awk '{print $2}')
24-
if [ "$REGION" == "" ]; then
24+
if [ "$REGION" = "" ]; then
2525
echo "Cannot find REGION from $CLUSTER_NAME"
2626
return 1
2727
fi
2828
print "\rConnecting to $GKE_CLUSTER at $REGION"
29-
gcloud container clusters get-credentials $GKE_CLUSTER --region $REGION > $HOME/.kube/config
30-
export KUBECONFIG=$HOME/.kube/config
31-
echo "KUBECONFIG set"
29+
export KUBECONFIG=$HOME/.kube/config-gke
30+
gcloud container clusters get-credentials $GKE_CLUSTER --region $REGION
31+
echo "KUBECONFIG set to $KUBECONFIG"
3232
echo "Namespace: $NS"

src/local/use-kind.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
(return 0 2>/dev/null) && sourced=1 || sourced=0
3-
if [ "$sourced" == "0" ]; then
3+
if [ "$sourced" = "0" ]; then
44
echo "This script must be invoked using: source $0 $*"
55
exit 1
66
fi
77
export K8S_DRIVER=kind
88
export KUBECONFIG=
9-
if [ "$1" == "" ]; then
9+
if [ "$1" = "" ]; then
1010
export NS=default
1111
else
1212
export NS=$1

src/local/use-mk-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
(return 0 2>/dev/null) && sourced=1 || sourced=0
33
if ((sourced == 0)); then
44
echo "This script must be invoked using: source $0 $*"

0 commit comments

Comments
 (0)