Skip to content

Commit b94cc5d

Browse files
svoonnaxipsita-npgyvuppalx
authored
Resolved shell check issues (#14)
Co-authored-by: ipsita-npg <[email protected]> Co-authored-by: yvuppalx <[email protected]>
1 parent 27674f0 commit b94cc5d

30 files changed

+382
-365
lines changed

.github/workflows/auto-close.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
name: Stale Pull Requests
66

7-
# After 30 days of no activity on a PR, the PR should be marked as stale,
8-
# a comment made on the PR informing the author of the new status,
7+
# After 30 days of no activity on a PR, the PR should be marked as stale,
8+
# a comment made on the PR informing the author of the new status,
99
# and closed after 15 days if there is no further activity from the change to stale state.
1010
on:
1111
schedule:
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
2424
with:
2525
repo-token: ${{ secrets.GITHUB_TOKEN }}
26-
stale-pr-message: 'This pull request is stale because it has been open 30 days with no activity. Make a comment or update the PR to avoid closing PR after 15 days.'
26+
stale-pr-message: "This pull request is stale because it has been open 30 days with no activity. Make a comment or update the PR to avoid closing PR after 15 days."
2727
days-before-pr-stale: 30
2828
days-before-pr-close: 15
2929
remove-pr-stale-when-updated: 'true'

.github/workflows/pre-merge.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ jobs:
8282
run_test: false
8383
run_validate_clean_folder: false
8484
run_docker_build: true
85-
run_artifact: false
85+
run_artifact: true
86+
artifacts_path: "standalone-node/shellcheck_report.txt"
8687
prefix_tag_separator: "/"
8788
project_folder: ${{ matrix.project_folder }}
8889
trivy_image_skip: "postgres:16.4"

common.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ $(VENV_NAME): requirements.txt
4141

4242
#### Lint and Validator Targets ####
4343
# https://github.com/koalaman/shellcheck
44-
SH_FILES := $(shell find . -type f \( -name '*.sh' \) -print )
44+
SH_FILES := $(shell find . -type f \( -name '*.sh' \) ! -path './cluster_installers/install.sh' -print)
4545
shellcheck: ## lint shell scripts with shellcheck
4646
shellcheck --version
47-
shellcheck -x -S style $(SH_FILES)
47+
shellcheck -x -S style $(SH_FILES) >> shellcheck_report.txt
4848

4949
# https://pypi.org/project/reuse/
5050
license: $(VENV_NAME) ## Check licensing with the reuse tool
@@ -86,4 +86,4 @@ help: ## Print help for each target
8686
@echo "-------------------- ---------------- -----------------------------------------"
8787
@grep -H -n '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
8888
| sort -t ":" -k 3 \
89-
| awk 'BEGIN {FS=":"}; {sub(".* ## ", "", $$4)}; {printf "%-20s %-16s %s\n", $$3, $$1 ":" $$2, $$4};'
89+
| awk 'BEGIN {FS=":"}; {sub(".* ## ", "", $$4)}; {printf "%-20s %-16s %s\n", $$3, $$1 ":" $$2, $$4};'

standalone-node/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ configure:
4545
echo 'socks_proxy=$(socks_proxy)' >> hook_os/config
4646
echo 'no_proxy=$(no_proxy)' >> hook_os/config
4747

48-
lint: license yamllint mdlint
48+
lint: license yamllint mdlint shellcheck
4949

5050
build: configure
5151
@# Help: Runs build stage

standalone-node/cluster_installers/build_package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#!/bin/bash
12
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
23
# SPDX-License-Identifier: Apache-2.0
34

4-
#!/bin/bash
55

66
if [ "$1" == "--no-ext-image" ]; then
77
tar --exclude './extensions-templates' --exclude './docs' --exclude './charts' --exclude './download_charts_and_images.sh' --exclude './cleanup-artifacts.sh' --exclude 'build_package.sh' --exclude './sen-uninstall-rke2.sh' --exclude './images' -cvf sen-rke2-package.tar.gz ./*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#!/bin/bash
12
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
23
# SPDX-License-Identifier: Apache-2.0
34

4-
#!/bin/bash
55

66
# Remove RKE2 artifacts from directory
77
rm -rf ./rke2* ./images ./charts ./sha256sum-amd64.txt ./install.sh ./sen-rke2-package.tar.gz

standalone-node/cluster_installers/download_charts_and_images.sh

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#!/bin/bash
12
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
23
# SPDX-License-Identifier: Apache-2.0
34

4-
#!/bin/bash
55

66
IMG_DIR=./images
77
CHRT_DIR=./charts
@@ -84,28 +84,28 @@ download_extension_charts () {
8484
url=$(echo "${chart}" | awk -F':' '{print $3":"$4}')
8585
version=$(echo "${chart}" | awk -F':' '{print $5}')
8686

87-
if [ ${repo} == "intel-rs" ]; then
88-
echo Fetching ${name} chart
89-
helm fetch -d ${CHRT_DIR} ${url}/${name} --version ${version}
90-
base64 -w 0 ${CHRT_DIR}/${name}-$version.tgz > ${CHRT_DIR}/$name.base64
87+
if [ "${repo}" == "intel-rs" ]; then
88+
echo Fetching "${name}" chart
89+
helm fetch -d ${CHRT_DIR} "${url}"/"${name}" --version "${version}"
90+
base64 -w 0 ${CHRT_DIR}/"${name}"-"$version".tgz > ${CHRT_DIR}/"$name".base64
9191

9292
else
93-
echo Fetching ${name} chart
94-
helm repo add ${repo} ${url}
95-
helm fetch -d ${CHRT_DIR} ${repo}/${name} --version ${version}
96-
if [ ${name} == "cert-manager" ]; then version="v${version}"; fi
97-
if [ ${name} == "node-feature-discovery" ]; then version="chart-${version}"; fi
98-
base64 -w 0 ${CHRT_DIR}/${name}-${version}.tgz > ${CHRT_DIR}/${name}.base64
93+
echo Fetching "${name}" chart
94+
helm repo add "${repo}" "${url}"
95+
helm fetch -d ${CHRT_DIR} "${repo}"/"${name}" --version "${version}"
96+
if [ "${name}" == "cert-manager" ]; then version="v${version}"; fi
97+
if [ "${name}" == "node-feature-discovery" ]; then version="chart-${version}"; fi
98+
base64 -w 0 ${CHRT_DIR}/"${name}"-"${version}".tgz > ${CHRT_DIR}/"${name}".base64
9999
fi
100100
# Remove unnecessary files from kube-prometheus-stack, reason: then base encoded file becomes to big and cannot be consumed when installing via add-on on RKE2
101-
if [ ${name} == "kube-prometheus-stack" ]; then
102-
tar -xzf ${CHRT_DIR}/${name}-${version}.tgz -C ${CHRT_DIR}
103-
rm -rf ${CHRT_DIR}/${name}-${version}.tgz
104-
rm ${CHRT_DIR}/${name}/README.md
105-
rm ${CHRT_DIR}/${name}/templates/grafana/dashboards-1.14/*windows*
106-
rm -rf ${CHRT_DIR}/${name}/templates/thanos-ruler
107-
tar -cf ${CHRT_DIR}/${name}-${version}.tgz --use-compress-program="gzip -9" -C ${CHRT_DIR} ${name}
108-
base64 -w 0 ${CHRT_DIR}/${name}-${version}.tgz > ${CHRT_DIR}/${name}.base64
101+
if [ "${name}" == "kube-prometheus-stack" ]; then
102+
tar -xzf ${CHRT_DIR}/"${name}"-"${version}".tgz -C ${CHRT_DIR}
103+
rm -rf ${CHRT_DIR}/"${name}"-"${version}".tgz
104+
rm ${CHRT_DIR}/"${name}"/README.md
105+
rm ${CHRT_DIR}/"${name}"/templates/grafana/dashboards-1.14/*windows*
106+
rm -rf ${CHRT_DIR}/"${name}"/templates/thanos-ruler
107+
tar -cf ${CHRT_DIR}/"${name}"-"${version}".tgz --use-compress-program="gzip -9" -C ${CHRT_DIR} "${name}"
108+
base64 -w 0 ${CHRT_DIR}/"${name}"-"${version}".tgz > ${CHRT_DIR}/"${name}".base64
109109
fi
110110
# Template HelmChart addon manifets using the base64 chart
111111
awk "/chartContent:/ {printf \" chartContent: \"; while ((getline line < \"${CHRT_DIR}/${name}.base64\") > 0) printf \"%s\", line; close(\"${CHRT_DIR}/${name}.base64\"); print \"\"; next} 1" "${TPL_DIR}/${name}.yaml" > "${EXT_DIR}/${name}.yaml"
@@ -122,15 +122,15 @@ download_extension_images () {
122122
echo "Downloading container images"
123123
mkdir -p ${IMG_DIR}
124124
for image in "${images[@]}" ; do
125-
podman pull ${image}
126-
img_name=$(echo ${image##*/} | tr ':' '-')
125+
podman pull "${image}"
126+
img_name=$(echo "${image##*/}" | tr ':' '-')
127127
DEST=${IMG_DIR}/${TAR_PRX}-${img_name}.${TAR_SFX}
128-
podman image save --output ${DEST}.tmp ${image}
129-
bsdtar -c -f ${DEST} --include=manifest.json --include=repositories @${DEST}.tmp
130-
bsdtar -r -f ${DEST} --exclude=manifest.json --exclude=repositories @${DEST}.tmp
131-
rm -f ${DEST}.tmp
132-
zstd -T0 -16 -f --long=25 --no-progress ${DEST} -o ${IMG_DIR}/${TAR_PRX}-${img_name}.${TAR_SFX}.zst
133-
rm -f ${DEST}
128+
podman image save --output "${DEST}".tmp "${image}"
129+
bsdtar -c -f "${DEST}" --include=manifest.json --include=repositories @"${DEST}".tmp
130+
bsdtar -r -f "${DEST}" --exclude=manifest.json --exclude=repositories @"${DEST}".tmp
131+
rm -f "${DEST}".tmp
132+
zstd -T0 -16 -f --long=25 --no-progress "${DEST}" -o ${IMG_DIR}/${TAR_PRX}-"${img_name}".${TAR_SFX}.zst
133+
rm -f "${DEST}"
134134
done
135135
}
136136
# Download K8s dashboard

standalone-node/cluster_installers/sen-rke2-installer.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#!/bin/bash
12
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
23
# SPDX-License-Identifier: Apache-2.0
34

4-
#!/bin/bash
55

66
RKE_INSTALLER_PATH=/"${1:-/tmp/rke2-artifacts}"
77
# for basic testing on a coder setup
@@ -96,7 +96,7 @@ EOF'
9696

9797
# Install RKE2
9898
echo "$(date): Installing RKE2 2/13" | sudo tee -a /var/log/cluster-init.log | sudo tee /dev/tty0
99-
sudo INSTALL_RKE2_ARTIFACT_PATH=${RKE_INSTALLER_PATH} sh install.sh
99+
sudo INSTALL_RKE2_ARTIFACT_PATH="${RKE_INSTALLER_PATH}" sh install.sh
100100

101101
# Copy the cni tarballs
102102
echo "$(date): Copying images and extensions 3/13" | sudo tee -a /var/log/cluster-init.log | sudo tee /dev/tty0
@@ -126,7 +126,7 @@ until sudo -E KUBECONFIG=/etc/rancher/rke2/rke2.yaml /var/lib/rancher/rke2/bin/k
126126
echo "$(date): RKE2 started 6/13" | sudo tee -a /var/log/cluster-init.log | sudo tee /dev/tty0
127127
# Label node as a worker
128128
hostname=$(hostname | tr '[:upper:]' '[:lower:]')
129-
sudo -E KUBECONFIG=/etc/rancher/rke2/rke2.yaml /var/lib/rancher/rke2/bin/kubectl label node $hostname node-role.kubernetes.io/worker=true
129+
sudo -E KUBECONFIG=/etc/rancher/rke2/rke2.yaml /var/lib/rancher/rke2/bin/kubectl label node "$hostname" node-role.kubernetes.io/worker=true
130130

131131
# Wait for the deployment to complete
132132

standalone-node/cluster_installers/sen-uninstall-rke2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#!/bin/bash
12
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
23
# SPDX-License-Identifier: Apache-2.0
34

4-
#!/bin/bash
55

66
# for basic testing on a coder setup
77
if grep -q "Ubuntu" /etc/os-release; then

standalone-node/hook_os/bash/docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function check_docker_daemon_for_sanity() {
2121
fi
2222

2323
# Once we know docker is sane, hook up a function that helps us trace invocations.
24+
# shellcheck disable=SC2317
2425
function docker() {
2526
log debug "--> docker $*"
2627
command docker "$@"

0 commit comments

Comments
 (0)