Commit b83395c6 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/develop-ci' into develop_integration_2018_w39

parents bb566eae 4aa5650c
...@@ -31,6 +31,9 @@ def testXMLFile = params.pythonTestXmlFile ...@@ -31,6 +31,9 @@ def testXMLFile = params.pythonTestXmlFile
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
// Name of the phone resource
def ciSmartPhoneResource = params.smartphonesResource
// Terminate Status // Terminate Status
def termUE = 0 def termUE = 0
def termENB = 1 def termENB = 1
...@@ -70,6 +73,7 @@ pipeline { ...@@ -70,6 +73,7 @@ pipeline {
string(name: 'pythonTestXmlFile', defaultValue: 'enb_usrpB210_band7_50PRB.xml', description: 'Location of the Test XML to be run') string(name: 'pythonTestXmlFile', defaultValue: 'enb_usrpB210_band7_50PRB.xml', description: 'Location of the Test XML to be run')
string(name: 'pipelineTestStageName', defaultValue: 'Test COTS-UE - OAI eNB - LTEBOX EPC', description: 'Naming of the Test Stage') string(name: 'pipelineTestStageName', defaultValue: 'Test COTS-UE - OAI eNB - LTEBOX EPC', description: 'Naming of the Test Stage')
booleanParam(name: 'pipelineZipsConsoleLog', defaultValue: 'True', description: 'If true, the pipeline script retrieves the job console log, zips it and archives it as artifact') booleanParam(name: 'pipelineZipsConsoleLog', defaultValue: 'True', description: 'If true, the pipeline script retrieves the job console log, zips it and archives it as artifact')
string(name: 'smartphonesResource', defaultValue: 'CI-Bench-1-Phones', description: 'Lockeable Resource to prevent multiple jobs to run simultaneously with the same resource')
//eNB parameters //eNB parameters
string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB') string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB')
...@@ -112,6 +116,9 @@ pipeline { ...@@ -112,6 +116,9 @@ pipeline {
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
if (params.smartphonesResource == null) {
allParametersPresent = false
}
if (params.eNB_IPAddress == null) { if (params.eNB_IPAddress == null) {
allParametersPresent = false allParametersPresent = false
} }
...@@ -178,6 +185,7 @@ pipeline { ...@@ -178,6 +185,7 @@ pipeline {
steps { steps {
script { script {
dir ('ci-scripts') { dir ('ci-scripts') {
lock (ciSmartPhoneResource) {
try { try {
echo "\u2705 \u001B[32m${testStageName}\u001B[0m" echo "\u2705 \u001B[32m${testStageName}\u001B[0m"
withCredentials([ withCredentials([
...@@ -190,6 +198,7 @@ pipeline { ...@@ -190,6 +198,7 @@ pipeline {
} catch (Exception e) { } catch (Exception e) {
currentBuild.result = 'FAILURE' currentBuild.result = 'FAILURE'
} }
}
} }
} }
} }
......
...@@ -120,21 +120,34 @@ echo "Source Branch is : $SOURCE_BRANCH" ...@@ -120,21 +120,34 @@ echo "Source Branch is : $SOURCE_BRANCH"
echo "Target Branch is : $TARGET_BRANCH" echo "Target Branch is : $TARGET_BRANCH"
echo "Merged Commit is : $MERGE_COMMMIT" echo "Merged Commit is : $MERGE_COMMMIT"
echo "Target Init is : $TARGET_INIT_COMMIT" echo "Target Init is : $TARGET_INIT_COMMIT"
echo ""
echo " ----------------------------------------------------------"
echo ""
# Retrieve the list of modified files since the latest develop commit # Retrieve the list of modified files since the latest develop commit
MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq` MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq`
NB_TO_FORMAT=0 NB_TO_FORMAT=0
if [ -f oai_rules_result_list.txt ]
then
rm -f oai_rules_result_list.txt
fi
for FULLFILE in $MODIFIED_FILES for FULLFILE in $MODIFIED_FILES
do do
echo $FULLFILE
filename=$(basename -- "$FULLFILE") filename=$(basename -- "$FULLFILE")
EXT="${filename##*.}" EXT="${filename##*.}"
if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ] if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ]
then then
TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted ` TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted `
NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT)) NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT))
if [ $TO_FORMAT -ne 0 ]
then
echo $FULLFILE
echo $FULLFILE >> ./oai_rules_result_list.txt
fi
fi fi
done done
echo ""
echo " ----------------------------------------------------------"
echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT" echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT"
echo $NB_TO_FORMAT > ./oai_rules_result.txt echo $NB_TO_FORMAT > ./oai_rules_result.txt
......
...@@ -90,38 +90,50 @@ class SSHConnection(): ...@@ -90,38 +90,50 @@ class SSHConnection():
self.htmlUEConnected = 0 self.htmlUEConnected = 0
def open(self, ipaddress, username, password): def open(self, ipaddress, username, password):
self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress], timeout = 5) count = 0
self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT]) connect_status = False
if self.sshresponse == 0: while count < 4:
self.ssh.sendline('yes') self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress], timeout = 5)
self.ssh.expect('password:') self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT])
self.ssh.sendline(password)
self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
pass
else:
logging.debug('self.sshresponse = ' + str(self.sshresponse))
sys.exit('SSH Connection Failed')
elif self.sshresponse == 1:
self.ssh.sendline(password)
self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0: if self.sshresponse == 0:
pass self.ssh.sendline('yes')
self.ssh.expect('password:')
self.ssh.sendline(password)
self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
count = 10
connect_status = True
else:
logging.debug('self.sshresponse = ' + str(self.sshresponse))
elif self.sshresponse == 1:
self.ssh.sendline(password)
self.sshresponse = self.ssh.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
count = 10
connect_status = True
else:
logging.debug('self.sshresponse = ' + str(self.sshresponse))
elif self.sshresponse == 2:
# Checking if we are really on the remote client defined by its IP address
self.command('stdbuf -o0 ifconfig | egrep --color=never "inet addr:"', '\$', 5)
result = re.search(str(ipaddress), str(self.ssh.before))
if result is None:
self.close()
else:
count = 10
connect_status = True
else: else:
# debug output
logging.debug(str(self.ssh.before))
logging.debug('self.sshresponse = ' + str(self.sshresponse)) logging.debug('self.sshresponse = ' + str(self.sshresponse))
sys.exit('SSH Connection Failed') # adding a tempo when failure
elif self.sshresponse == 2: if not connect_status:
# Checking if we are really on the remote client defined by its IP address time.sleep(1)
self.command('stdbuf -o0 ifconfig | egrep --color=never "inet addr:"', '\$', 5) count += 1
result = re.search(str(ipaddress), str(self.ssh.before)) if connect_status:
if result is None:
sys.exit('SSH Connection Failed: TIMEOUT !!!')
pass pass
else: else:
# debug output sys.exit('SSH Connection Failed')
logging.debug(str(self.ssh.before))
logging.debug('self.sshresponse = ' + str(self.sshresponse))
sys.exit('SSH Connection Failed!!!')
def command(self, commandline, expectedline, timeout): def command(self, commandline, expectedline, timeout):
logging.debug(commandline) logging.debug(commandline)
......
...@@ -260,7 +260,7 @@ function sca_summary_table_footer { ...@@ -260,7 +260,7 @@ function sca_summary_table_footer {
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
echo " </table>" >> ./build_results.html echo " </table>" >> ./build_results.html
echo " <p>Full details in zipped artifact (cppcheck/cppcheck.xml) </p>" >> ./build_results.html echo " <p>Full details in zipped artifact (cppcheck/cppcheck.xml) </p>" >> ./build_results.html
echo " <p>Graphical Interface tool : <code>cppcheck-gui -l cppcheck/cppcheck.xml</code> </p>" >> ./build_results.html echo " <p style=\"margin-left: 30px\">Graphical Interface tool : <strong><code>cppcheck-gui -l cppcheck/cppcheck.xml</code></strong></p>" >> ./build_results.html
} }
jb_checker=0 jb_checker=0
...@@ -490,12 +490,20 @@ then ...@@ -490,12 +490,20 @@ then
then then
if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All files in repository follow OAI rules. </td>" >> ./build_results.html; fi if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All files in repository follow OAI rules. </td>" >> ./build_results.html; fi
if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All modified files in Merge-Request follow OAI rules.</td>" >> ./build_results.html; fi if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All modified files in Merge-Request follow OAI rules.</td>" >> ./build_results.html; fi
echo " </tr>" >> ./build_results.html
echo " </table>" >> ./build_results.html
else else
if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES files in repository DO NOT follow OAI rules. </td>" >> ./build_results.html; fi if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES files in repository DO NOT follow OAI rules. </td>" >> ./build_results.html; fi
if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES modified files in Merge-Request DO NOT follow OAI rules.</td>" >> ./build_results.html; fi if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES modified files in Merge-Request DO NOT follow OAI rules.</td>" >> ./build_results.html; fi
echo " </tr>" >> ./build_results.html
if [ -f ./oai_rules_result_list.txt ]
then
awk '{print " <tr><td></td><td>"$1"</td></tr>"}' ./oai_rules_result_list.txt >> ./build_results.html
fi
echo " </table>" >> ./build_results.html
echo " <p>Please apply the following command to this(ese) file(s): </p>" >> ./build_results.html
echo " <p style=\"margin-left: 30px\"><strong><code>astyle --options=ci-scripts/astyle-options.txt filename(s)</code></strong></p>" >> ./build_results.html
fi fi
echo " </tr>" >> ./build_results.html
echo " </table>" >> ./build_results.html
fi fi
echo " <h2>Ubuntu 16.04 LTS -- Summary</h2>" >> ./build_results.html echo " <h2>Ubuntu 16.04 LTS -- Summary</h2>" >> ./build_results.html
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment