aboutsummaryrefslogtreecommitdiff
path: root/.scripts.d/10-check.sh
diff options
context:
space:
mode:
authorChristian Segundo2024-04-07 10:45:05 +0200
committerChristian Segundo2024-04-07 18:19:48 +0200
commit8206fecdb86f05d353ef25c9596cebca5c1d28fb (patch)
tree169f50213c94e8a558bf1c235871c764045f4338 /.scripts.d/10-check.sh
parent3891426ce8deba513c5bcf1594987bdcfc837304 (diff)
downloadjenkins-agent-docker-cli-8206fecdb86f05d353ef25c9596cebca5c1d28fb.tar.gz
install buildx
Diffstat (limited to '.scripts.d/10-check.sh')
-rw-r--r--.scripts.d/10-check.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/.scripts.d/10-check.sh b/.scripts.d/10-check.sh
new file mode 100644
index 0000000..e8ddf59
--- /dev/null
+++ b/.scripts.d/10-check.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# vim: ai:ts=8:sw=8:noet
+set -EeufCo pipefail
+export SHELLOPTS # propagate set to children by default
+IFS=$'\t\n'
+
+# check required commands are in place
+command -v shellcheck >/dev/null 2>&1 || {
+ echo 'please install shellcheck'
+ exit 1
+}
+command -v hadolint >/dev/null 2>&1 || {
+ echo 'please install hadolint'
+ exit 1
+}
+command -v yamllint >/dev/null 2>&1 || {
+ echo 'please install yamllint'
+ exit 1
+}
+
+# check all the Dockerfiles with hadolint
+find . \
+ -type f \
+ -name 'Dockerfile' \
+ -print0 |
+ xargs -0 -r hadolint
+
+# check all the yaml files with yamllint
+find . -type f \
+ -regex '.*\.ya?ml\(lint\)?' \
+ -print0 |
+ xargs -0 -r yamllint -s
+
+# check all sh files with shellcheck
+find . \
+ -type f \
+ -name '*.sh' \
+ -print0 |
+ xargs -0 -r shellcheck