diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3758bd6..305b2c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,9 @@ jobs: uses: DavidAnson/markdownlint-cli2-action@v16 with: globs: '**/*.md' + # checking shell code with ShellCheck (https://github.com/koalaman/shellcheck) - name: Installs packages run: sudo apt install shellcheck - name: Checks shell file code run: - shellcheck scripts/**/*.sh + shellcheck -e SC2148 scripts/**/*.sh diff --git a/scripts/download.sh b/scripts/download.sh index 8c5a299..2900747 100644 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -1,4 +1,5 @@ #!/bin/sh +# Script to download a specific version of the scripts from GitHub # Usage: # curl ... | ENV_VAR=... sh - diff --git a/scripts/index.sh b/scripts/index.sh index d93eeaa..07b2f22 100644 --- a/scripts/index.sh +++ b/scripts/index.sh @@ -1,3 +1,6 @@ +#!/bin/bash +# File to be sourced to have all shell functions available in the bash terminal + SCRIPT_FOLDER=$(dirname "${BASH_SOURCE[0]}") for file in ${SCRIPT_FOLDER}/*/*.sh do { diff --git a/scripts/k3s/cluster-lifecycle.sh b/scripts/k3s/cluster-lifecycle.sh index 4710276..0916e65 100644 --- a/scripts/k3s/cluster-lifecycle.sh +++ b/scripts/k3s/cluster-lifecycle.sh @@ -1,3 +1,4 @@ +#!/bin/sh # Collection of functions to manage K3s cluster lifecycle ####################################### diff --git a/scripts/kubernetes/certificate-management.sh b/scripts/kubernetes/certificate-management.sh index e01865c..1e43f2a 100644 --- a/scripts/kubernetes/certificate-management.sh +++ b/scripts/kubernetes/certificate-management.sh @@ -1,3 +1,4 @@ +#!/bin/sh # Collection of functions to add components to manage certificates in a Kubernetes cluster ####################################### diff --git a/scripts/kubernetes/cluster-status.sh b/scripts/kubernetes/cluster-status.sh index 802f5c9..f2be8e6 100644 --- a/scripts/kubernetes/cluster-status.sh +++ b/scripts/kubernetes/cluster-status.sh @@ -1,3 +1,4 @@ +#!/bin/sh # Collection of functions to add query status on a Kubernetes cluster ####################################### @@ -14,7 +15,7 @@ k8s_wait_fornodesandpods() { sleep 5 done while true; do - NOT_READY_NODES=$(kubectl get nodes --no-headers 2>/dev/null | grep -v " Ready" | wc -l) + NOT_READY_NODES=$(kubectl get nodes --no-headers 2>/dev/null | grep -c " Ready") if [ "$NOT_READY_NODES" -eq 0 ]; then echo "All nodes are ready." break diff --git a/scripts/rancher/cluster-actions.sh b/scripts/rancher/cluster-actions.sh index 8c8ef9d..e03abf3 100644 --- a/scripts/rancher/cluster-actions.sh +++ b/scripts/rancher/cluster-actions.sh @@ -1,3 +1,4 @@ +#!/bin/sh # Collection of functions to manage clusters from Rancher ####################################### diff --git a/scripts/rancher/manager-lifecycle.sh b/scripts/rancher/manager-lifecycle.sh index 6ba337b..a8fca23 100644 --- a/scripts/rancher/manager-lifecycle.sh +++ b/scripts/rancher/manager-lifecycle.sh @@ -1,3 +1,4 @@ +#!/bin/sh # Collection of functions to manage Rancher lifecycle ####################################### diff --git a/scripts/rancher/manager-settings.sh b/scripts/rancher/manager-settings.sh index 5d48c64..c1270d9 100644 --- a/scripts/rancher/manager-settings.sh +++ b/scripts/rancher/manager-settings.sh @@ -1,3 +1,4 @@ +#!/bin/sh # Collection of functions to update Rancher settings ####################################### diff --git a/scripts/rancher/user-actions.sh b/scripts/rancher/user-actions.sh index 3c29f08..ac19f55 100644 --- a/scripts/rancher/user-actions.sh +++ b/scripts/rancher/user-actions.sh @@ -1,3 +1,4 @@ +#!/bin/sh # Collection of functions to make user actions ####################################### @@ -77,7 +78,7 @@ rancher_create_apikey() { -H "Authorization: Bearer $token" \ --data-binary '{ "type": "token", - "description": "${description}", + "description": "$description", "ttl": 0 }') echo "DEBUG API_KEY_RESPONSE=${API_KEY_RESPONSE}"