[ONOS-7346] Ver.j

Change-Id: Ibdcfcc241b00379ab9f06707ce1f6725c9552715
diff --git a/jjb/OnosSystemTest/check-style.sh b/jjb/OnosSystemTest/check-style.sh
index 094e896..79cbe30 100644
--- a/jjb/OnosSystemTest/check-style.sh
+++ b/jjb/OnosSystemTest/check-style.sh
@@ -1,11 +1,5 @@
 #!/bin/bash
 
-cd $WORKSPACE
-rm -rf OnosSystemTest
-rm -f pep8Result.txt
-git clone https://gerrit.onosproject.org/OnosSystemTest; cd OnosSystemTest
-git review -d ${GERRIT_CHANGE_NUMBER}
-
 cd
 cd $WORKSPACE/OnosSystemTest/
 modifiedFiles=$(git diff-tree --no-commit-id --name-only -r HEAD | grep \.py) || modifiedFiles=""
@@ -17,6 +11,4 @@
     rm -rf $WORKSPACE/OnosSystemTest/
     echo "There were no files to code check, failing test so Jenkins doesn't comment."
     exit 2
-fi
-cat $WORKSPACE/pep8Result.txt
-rm -rf $WORKSPACE/OnosSystemTest/
\ No newline at end of file
+fi
\ No newline at end of file
diff --git a/jjb/OnosSystemTest/onos-test-freestyle.yaml b/jjb/OnosSystemTest/onos-test-freestyle.yaml
index b439440..e1b0607 100644
--- a/jjb/OnosSystemTest/onos-test-freestyle.yaml
+++ b/jjb/OnosSystemTest/onos-test-freestyle.yaml
@@ -212,13 +212,39 @@
 
     builders:
 
-      - shell: !include-raw-escape: check-style.sh
+      - shell: !include-raw-escape: pre-check-style.sh
+      - shell:
+        command: |
+          #!/bin/bash
+          cd
+          cd $WORKSPACE/OnosSystemTest/
+          modifiedFiles=$(git diff-tree --no-commit-id --name-only -r HEAD | grep \.py) || modifiedFiles=""
+          if [ -n "$modifiedFiles" ]
+          then
+              pep8 --repeat --show-source --show-pep8 --ignore=E251,E201,E302,E202,E126,E127,E203,E226,E501,W391 $modifiedFiles > $WORKSPACE/pep8Result.txt
+          else
+              touch $WORKSPACE/pep8Result.txt
+              rm -rf $WORKSPACE/OnosSystemTest/
+              echo "There were no files to code check, failing test so Jenkins doesn't comment."
+              exit 2
+          fi
+        unstable-return: 1
+      - shell: !include-raw-escape: post-check-style.sh
 
     publishers:
       - warnings:
          workspace-file-scanners:
            - file-pattern: pep8Result.txt
              scanner: Pep8
+         messages-to-ignore: |
+                              Skipping
+                              file
+                              of
+                              module
+                              /var/lib/jenkins/workspace/TestON_Style_Check/pep8Result.txt
+                              because
+                              it's
+                              empty.
 
 - job-template:
     name: delta-nightly
diff --git a/jjb/OnosSystemTest/onos-test-pipeline.yaml b/jjb/OnosSystemTest/onos-test-pipeline.yaml
index adf5b4e..8d32791 100644
--- a/jjb/OnosSystemTest/onos-test-pipeline.yaml
+++ b/jjb/OnosSystemTest/onos-test-pipeline.yaml
@@ -21,6 +21,7 @@
 
       - build-discarder:
          num-to-keep: 20
+    gitURL: https://gerrit.onosproject.org/OnosSystemTest
 
 - test-pipe-init-procedure-plate: &test-pipe-init-procedure-plate
     name: test-pipe-init-procedure-plate
@@ -114,8 +115,7 @@
       script-path: '{jenkins-path}/JenkinsfileTrigger'
       scm:
         - git:
-           url: '$GIT_URL/$GERRIT_PROJECT'
-           credentials-id: '{jenkins-ssh-credential}'
+           url: '{gitURL}'
            branches:
              - 'master'
 
@@ -144,8 +144,7 @@
       script-path: '{jenkins-path}/{type}JenkinsFile'
       scm:
         - git:
-           url: '$GIT_URL/$GERRIT_PROJECT'
-           credentials-id: '{jenkins-ssh-credential}'
+           url: '{gitURL}'
            branches:
              - 'master'
 
@@ -185,8 +184,7 @@
       script-path: '{jenkins-path}/SCPF_Graph_Generator'
       scm:
         - git:
-           url: '$GIT_URL/$GERRIT_PROJECT'
-           credentials-id: '{jenkins-ssh-credential}'
+           url: '{gitURL}'
            branches:
              - 'master'
 
@@ -240,8 +238,7 @@
       script-path: '{jenkins-path}/Trend_Graph_Generator'
       scm:
         - git:
-           url: '$GIT_URL/$GERRIT_PROJECT'
-           credentials-id: '{jenkins-ssh-credential}'
+           url: '{gitURL}'
            branches:
              - 'master'
 
diff --git a/jjb/OnosSystemTest/post-check-style.sh b/jjb/OnosSystemTest/post-check-style.sh
new file mode 100644
index 0000000..64d623d
--- /dev/null
+++ b/jjb/OnosSystemTest/post-check-style.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+cat $WORKSPACE/pep8Result.txt
+rm -rf $WORKSPACE/OnosSystemTest/
\ No newline at end of file
diff --git a/jjb/OnosSystemTest/pre-check-style.sh b/jjb/OnosSystemTest/pre-check-style.sh
new file mode 100644
index 0000000..f2d3924
--- /dev/null
+++ b/jjb/OnosSystemTest/pre-check-style.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+cd $WORKSPACE
+rm -rf OnosSystemTest
+rm -f pep8Result.txt
+git clone https://gerrit.onosproject.org/OnosSystemTest; cd OnosSystemTest
+git review -d ${GERRIT_CHANGE_NUMBER}
\ No newline at end of file