fix the bug of patch verify 13/46913/2
authorwutianwei <wutianwei1@huawei.com>
Thu, 9 Nov 2017 07:15:40 +0000 (15:15 +0800)
committerwutianwei <wutianwei1@huawei.com>
Thu, 9 Nov 2017 07:53:43 +0000 (15:53 +0800)
If one patch don't modify the "yml" or "yaml" file,
the script will exit with 1 at egrep "ya?ml$", then mark build as failure.
In my opinion, if not modify the "yml" or "yaml" file, the yamllint should be successful.
So we need mark the result of egrep "ya?ml$" as true, then judge the $YAML_FILES.

Change-Id: I8abcadc9e4c85935ac7b20cdf54713b9800108ba
Signed-off-by: wutianwei <wutianwei1@huawei.com>
jjb/global/releng-macros.yml

index 62c22bd..ba4e930 100644 (file)
           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$")
+          YAML_FILES=$(git --no-pager diff --diff-filter=MCRAT --name-only HEAD^1 | egrep "ya?ml$") || true
+
+          #If YAML_FILES is none exit with 0
+          if [ -z "$YAML_FILES" ]; then
+              exit 0
+          fi
 
           # Ensure we start with a clean environment
           rm -f yaml-violation.log lint.log