Merge "Set Functest MultiJob as arch independent"
[releng.git] / jjb / global / releng-macros.yml
index 6091571..0876694 100644 (file)
               gsutil -m rm -r "gs://$gs_path"
           fi
 
-- builder:
-    name: build-and-upload-artifacts-json-api
-    builders:
-      - shell: |
-          #!/bin/bash
-          set -o errexit
-          set -o pipefail
-          export PATH=$PATH:/usr/local/bin/
-
-          virtualenv -p python2.7 $WORKSPACE/releng_artifacts
-          source $WORKSPACE/releng_artifacts/bin/activate
-
-          # install python packages
-          pip install google-api-python-client
-
-          # generate and upload index file
-          echo "Generating Artifacts API ..."
-          python $WORKSPACE/utils/opnfv-artifacts.py > index.json
-          gsutil cp index.json gs://artifacts.opnfv.org/index.json
-
-          deactivate
-
 - builder:
     name: lint-python-code
     builders:
           export PATH=$PATH:/usr/local/bin/
 
           # install python packages
-          pip install "yamllint==1.6.0"
+          sudo pip install "yamllint==1.8.2"
 
           # 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$") || 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
 
-          # 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