diff options
author | Trevor Bramwell <tbramwell@linuxfoundation.org> | 2017-10-16 09:37:13 -0700 |
---|---|---|
committer | Trevor Bramwell <tbramwell@linuxfoundation.org> | 2017-10-18 16:30:31 -0700 |
commit | 8c22329ff22b11f6921ace6a90d6cbfa5c42a6d9 (patch) | |
tree | 7ccc035585b2690330495d563809cf2df7cbcbce | |
parent | 0431f1d23f053fd17b6c89502226325b42f3bafa (diff) |
Switch yamllint job to only run against new files
Intead of yamllint all files at once yamllint will only run against new
or modified yaml files.
Change-Id: I10b951427966409e15fb773b959adbd780497bad
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
-rw-r--r-- | jjb/global/releng-macros.yml | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/jjb/global/releng-macros.yml b/jjb/global/releng-macros.yml index 59415f5ca..fe2ec7b01 100644 --- a/jjb/global/releng-macros.yml +++ b/jjb/global/releng-macros.yml @@ -450,18 +450,19 @@ # generate and upload lint log echo "Running yaml code on $PROJECT ..." + # Get list of yaml files + YAML_FILES=$(git --no-pager diff --diff-filter=MCRAT --name-only HEAD^1 | egrep "ya?ml$") + # Ensure we start with a clean environment rm -f yaml-violation.log lint.log - # Get number of yaml violations. If none, this will be an - # empty string: "" - find . \ - -type f -name "*.yml" -print \ - -o -name "*.yaml" -print | \ - xargs yamllint > yaml-violation.log || true + # Yamllint files only in patchset + for yamlfile in $YAML_FILES; do + yamllint $yamlfile >> yaml-violation.log || true + done if [ -s "yaml-violation.log" ]; then - SHOWN=$(cat yaml-violation.log| grep -v "^$" |wc -l) + SHOWN=$(grep -c -v "^$" yaml-violation.log) echo -e "First $SHOWN shown\n---" > lint.log cat yaml-violation.log >> lint.log sed -r -i '4,$s/^/ /g' lint.log |