kubernetes-sigs / sig-windows-dev-tools

This is a batteries included local development environment for Kubernetes on Windows.
Apache License 2.0
80 stars 46 forks source link

CI: Check in new PR if scripts have warnings/suggestions #163

Closed dougsland closed 2 years ago

dougsland commented 2 years ago

Issue

Example of warning in existing shell scripts:

#sig-windows-dev-tools/sync# shellcheck linux/controlplane.sh 

In linux/controlplane.sh line 1:
: '
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang.

In linux/controlplane.sh line 35:
k8s_linux_registry=${2}
^----------------^ SC2034: k8s_linux_registry appears unused. Verify use (or export if used externally).

In linux/controlplane.sh line 40:
echo "Using $kubernetes_version as the Kubernetes version"
            ^-----------------^ SC2154: kubernetes_version is referenced but not assigned.

In linux/controlplane.sh line 41:
echo "Overwriting bins is set to '$overwrite_bins'"
                                  ^-------------^ SC2154: overwrite_bins is referenced but not assigned.

In linux/controlplane.sh line 75:
kubelet=${k8s_linux_kubelet_deb}-00 \
        ^----------------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
kubelet="${k8s_linux_kubelet_deb}"-00 \

In linux/controlplane.sh line 76:
kubeadm=${k8s_linux_kubelet_deb}-00 \
        ^----------------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
kubeadm="${k8s_linux_kubelet_deb}"-00 \

In linux/controlplane.sh line 77:
kubectl=${k8s_linux_kubelet_deb}-00
        ^----------------------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
kubectl="${k8s_linux_kubelet_deb}"-00

In linux/controlplane.sh line 144:
mkdir -p $HOME/.kube
         ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
mkdir -p "$HOME"/.kube

In linux/controlplane.sh line 145:
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
                                      ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
sudo cp -i /etc/kubernetes/admin.conf "$HOME"/.kube/config

In linux/controlplane.sh line 146:
sudo chown $(id -u):$(id -g) $HOME/.kube/config
           ^------^ SC2046: Quote this to prevent word splitting.
                    ^------^ SC2046: Quote this to prevent word splitting.
                             ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
sudo chown $(id -u):$(id -g) "$HOME"/.kube/config

In linux/controlplane.sh line 149:
cp $HOME/.kube/config /var/sync/shared/config
   ^---^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
cp "$HOME"/.kube/config /var/sync/shared/config

More info: https://github.com/koalaman/shellcheck

dougsland commented 2 years ago

/good-first-issue

k8s-ci-robot commented 2 years ago

@dougsland: This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to [this](https://github.com/kubernetes-sigs/sig-windows-dev-tools/issues/163): >/good-first-issue Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.