From 6899b28d74cd4852b3fc6f6110ae898f9e21f204 Mon Sep 17 00:00:00 2001 From: Alexei Fedotov Date: Fri, 4 Apr 2025 14:50:30 +0200 Subject: [PATCH] Add shellcheck Signed-off-by: Alexei Fedotov --- .github/workflows/ci-build.yaml | 10 ++++++++++ generate-snyk-report.sh | 0 hack/generate-actions-list.sh | 4 +++- hack/trigger-release.sh | 2 +- test/e2e/testdata/cmp-preserve-file-mode/script.sh | 4 +++- ui/scripts/build_docker.sh | 4 ++-- util/io/files/testdata/executable/script.sh | 4 +++- 7 files changed, 22 insertions(+), 6 deletions(-) delete mode 100644 generate-snyk-report.sh diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 23024b6534361..c97e9d224b790 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -10,6 +10,7 @@ on: branches: - 'master' - 'release-*' + workflow_dispatch: env: # Golang version to use across CI steps @@ -333,6 +334,15 @@ jobs: run: yarn lint working-directory: ui/ + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0 + - run: | + sudo apt-get install shellcheck + shellcheck -e SC2086 -e SC2046 -e SC2068 -e SC2206 -e SC2048 -e SC2059 -e SC2154 -e SC2034 -e SC2016 -e SC2128 -e SC1091 -e SC2207 $(find . -type f -name '*.sh') | tee sc.log + test ! -s sc.log + analyze: name: Process & analyze test artifacts if: ${{ needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true' }} diff --git a/generate-snyk-report.sh b/generate-snyk-report.sh deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/hack/generate-actions-list.sh b/hack/generate-actions-list.sh index 61b0b4c7aa5ce..207be27efe597 100755 --- a/hack/generate-actions-list.sh +++ b/hack/generate-actions-list.sh @@ -1 +1,3 @@ -find resource_customizations -name action.lua | sed 's/resource_customizations\/\(.*\)\/actions\/\(.*\)\/action.lua/- [\1\/\2](https:\/\/github.com\/argoproj\/argo-cd\/blob\/master\/resource_customizations\/\1\/actions\/\2\/action.lua)/' | sort | uniq > docs/operator-manual/resource_actions_builtin.md \ No newline at end of file +#!/usr/bin/env bash + +find resource_customizations -name action.lua | sed 's/resource_customizations\/\(.*\)\/actions\/\(.*\)\/action.lua/- [\1\/\2](https:\/\/github.com\/argoproj\/argo-cd\/blob\/master\/resource_customizations\/\1\/actions\/\2\/action.lua)/' | sort | uniq > docs/operator-manual/resource_actions_builtin.md diff --git a/hack/trigger-release.sh b/hack/trigger-release.sh index b7f843fad7fd6..b226e43603d48 100755 --- a/hack/trigger-release.sh +++ b/hack/trigger-release.sh @@ -14,7 +14,7 @@ fi # Target (version) tag must match version scheme vMAJOR.MINOR.PATCH with an # optional pre-release tag. -if ! echo "${NEW_TAG}" | egrep -q '^v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)*$'; then +if ! echo "${NEW_TAG}" | grep -E -q '^v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)*$'; then echo "!! Malformed version tag: '${NEW_TAG}', must match 'vMAJOR.MINOR.PATCH(-rcX)'" >&2 exit 1 fi diff --git a/test/e2e/testdata/cmp-preserve-file-mode/script.sh b/test/e2e/testdata/cmp-preserve-file-mode/script.sh index 1fbb8fde0c14d..fb555ee6e08c9 100755 --- a/test/e2e/testdata/cmp-preserve-file-mode/script.sh +++ b/test/e2e/testdata/cmp-preserve-file-mode/script.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + cat << EOF apiVersion: v1 kind: ConfigMap @@ -5,4 +7,4 @@ metadata: name: test-cm data: foo: bar -EOF \ No newline at end of file +EOF diff --git a/ui/scripts/build_docker.sh b/ui/scripts/build_docker.sh index 9ad796a8b13bb..68c0ed1fffb91 100755 --- a/ui/scripts/build_docker.sh +++ b/ui/scripts/build_docker.sh @@ -4,9 +4,9 @@ set -e TAG=${IMAGE_TAG:-'latest'} -docker build --build-arg ARGO_VERSION=${TAG} -t ${IMAGE_NAMESPACE:-`whoami`}/argocd-ui:${TAG} . +docker build --build-arg ARGO_VERSION=${TAG} -t ${IMAGE_NAMESPACE:-$(whoami)}/argocd-ui:${TAG} . if [ "$DOCKER_PUSH" == "true" ] then - docker push ${IMAGE_NAMESPACE:-`whoami`}/argocd-ui:${TAG} + docker push ${IMAGE_NAMESPACE:-$(whoami)}/argocd-ui:${TAG} fi diff --git a/util/io/files/testdata/executable/script.sh b/util/io/files/testdata/executable/script.sh index e78c829c1730d..a33ea1e6de00a 100755 --- a/util/io/files/testdata/executable/script.sh +++ b/util/io/files/testdata/executable/script.sh @@ -1 +1,3 @@ -echo hello world \ No newline at end of file +#!/usr/bin/env bash + +echo hello world