summaryrefslogtreecommitdiffstats
path: root/tools/test-eco.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:06:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:06:49 +0000
commit2fe34b6444502079dc0b84365ce82dbc92de308e (patch)
tree8fedcab52bbbc3db6c5aa909a88a7a7b81685018 /tools/test-eco.sh
parentInitial commit. (diff)
downloadansible-lint-2fe34b6444502079dc0b84365ce82dbc92de308e.tar.xz
ansible-lint-2fe34b6444502079dc0b84365ce82dbc92de308e.zip
Adding upstream version 6.17.2.upstream/6.17.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/test-eco.sh')
-rwxr-xr-xtools/test-eco.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/test-eco.sh b/tools/test-eco.sh
new file mode 100755
index 0000000..55792af
--- /dev/null
+++ b/tools/test-eco.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+set -eu
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+
+if [[ -d "${SCRIPT_DIR}/../.cache/eco/.git" ]]; then
+ git -C "${SCRIPT_DIR}/../.cache/eco" pull
+else
+ mkdir -p "${SCRIPT_DIR}/../.cache"
+ git clone --recursive https://github.com/ansible-community/ansible-lint-eco "${SCRIPT_DIR}/../.cache/eco"
+fi
+pushd "${SCRIPT_DIR}/../.cache/eco/projects" > /dev/null
+
+
+for i in $(ls -d */); do
+ DIR=${i%%/}
+ RC=0
+ pushd $DIR > /dev/null
+ # Calling ansible lint without any positional arguments inside repository root
+ SECONDS=0
+ ANSIBLE_LINT_IGNORE_FILE=../$DIR.ignore.txt ansible-lint -qq --generate-ignore -f codeclimate | python3 -m json.tool > ../$DIR.json ||
+ RC=$?
+ echo "Got $RC RC on $DIR in $SECONDS seconds"
+ popd > /dev/null
+done
+popd > /dev/null
+# Fail if git reports dirty at the end
+git diff --exit-code