-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POSIX compatibility for test scripts (#548)
* Use portable shebang line * Replace some easily avoidable bashisms * Fix some small ShellCheck warnings * Allow local keyword, as all the interesting target shells support it (bash, ash, dash) Signed-off-by: Tom Wieczorek <[email protected]> Co-authored-by: Kimmo Lehto <[email protected]>
- Loading branch information
Showing
8 changed files
with
56 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env sh | ||
|
||
K0SCTL_CONFIG=${K0SCTL_CONFIG:-"k0sctl.yaml"} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
FOOTLOOSE_TEMPLATE=${FOOTLOOSE_TEMPLATE:-"footloose.yaml.tpl"} | ||
|
||
export LINUX_IMAGE=${LINUX_IMAGE:-"quay.io/footloose/ubuntu18.04"} | ||
export PRESERVE_CLUSTER=${PRESERVE_CLUSTER:-""} | ||
export LINUX_IMAGE="${LINUX_IMAGE:-"quay.io/footloose/ubuntu18.04"}" | ||
export PRESERVE_CLUSTER="${PRESERVE_CLUSTER:-""}" | ||
export DISABLE_TELEMETRY=true | ||
export K0S_VERSION | ||
|
||
function createCluster() { | ||
createCluster() { | ||
envsubst < "${FOOTLOOSE_TEMPLATE}" > footloose.yaml | ||
footloose create | ||
if [ "${LINUX_IMAGE}" = "quay.io/footloose/debian10" ]; then | ||
for host in $(footloose status -o json|grep hostname|cut -d"\"" -f4); do | ||
footloose ssh root@${host} -- rm -f /etc/machine-id /var/lib/dbus/machine-id | ||
footloose ssh root@${host} -- systemd-machine-id-setup | ||
footloose ssh root@"${host}" -- rm -f /etc/machine-id /var/lib/dbus/machine-id | ||
footloose ssh root@"${host}" -- systemd-machine-id-setup | ||
done | ||
fi | ||
} | ||
|
||
function deleteCluster() { | ||
deleteCluster() { | ||
# cleanup any existing cluster | ||
envsubst < "${FOOTLOOSE_TEMPLATE}" > footloose.yaml | ||
footloose delete && docker volume prune -f | ||
} | ||
|
||
|
||
function cleanup() { | ||
echo -e "Cleaning up..." | ||
cleanup() { | ||
echo "Cleaning up..." | ||
|
||
if [ -z "${PRESERVE_CLUSTER}" ]; then | ||
deleteCluster | ||
fi | ||
} | ||
|
||
function downloadKubectl() { | ||
downloadKubectl() { | ||
OS=$(uname | tr '[:upper:]' '[:lower:]') | ||
ARCH="amd64" | ||
case $(uname -m) in | ||
arm,arm64) ARCH="arm64" ;; | ||
esac | ||
[ -f kubectl ] || (curl -L https://storage.googleapis.com/kubernetes-release/release/v1.21.3/bin/${OS}/${ARCH}/kubectl > ./kubectl && chmod +x ./kubectl) | ||
[ -f kubectl ] || (curl -L https://storage.googleapis.com/kubernetes-release/release/v1.21.3/bin/"${OS}"/${ARCH}/kubectl > ./kubectl && chmod +x ./kubectl) | ||
./kubectl version --client | ||
} |