Index: build/build.sh =================================================================== diff -u -r080363bef8b6fdc47500ec5321c1b9e2b14c5afc -r46a7ac851fa42814068c93e02f89e179c129f583 --- build/build.sh (.../build.sh) (revision 080363bef8b6fdc47500ec5321c1b9e2b14c5afc) +++ build/build.sh (.../build.sh) (revision 46a7ac851fa42814068c93e02f89e179c129f583) @@ -255,7 +255,7 @@ # NOTE: find for Failed before adding the manual cases since there might be a # function containing the name Failed in it failedCases=$(cat $STATUS_REPORT | grep "Failed") -if [[ ! -z $failedCases ]] +if [[ -n $failedCases ]] then hasTestPassed=false fi Index: build/unittest.sh =================================================================== diff -u -redecf77d9b1f05a460811ed954713d536a16ad47 -r46a7ac851fa42814068c93e02f89e179c129f583 --- build/unittest.sh (.../unittest.sh) (revision edecf77d9b1f05a460811ed954713d536a16ad47) +++ build/unittest.sh (.../unittest.sh) (revision 46a7ac851fa42814068c93e02f89e179c129f583) @@ -440,6 +440,8 @@ local sonarRunCloudSyncProject="UI_Cloudsync-manualrun" local inlineScriptForReport="sonarReportGeneration.sh" local headTagOrCommit="" + local reportAddress="" + local nameOfReports=() echo " ------------------------------ Running SonarQube test" # Make a folder for SonarQube operations mkdir "$sonarFolder" @@ -522,17 +524,38 @@ echo "Sonar created file: $reportAddress" # Copy the created SonarQube file from the sonar server to the remote directory sshpass -f /opt/sonarQubeServerPass scp dnavaei@192.168.10.41:"$reportAddress" "$REPORT_DIR" + reportAddress=${reportAddress/.docx/.md} + sshpass -f /opt/sonarQubeServerPass scp dnavaei@192.168.10.41:"$reportAddress" "$REPORT_DIR" # Cloudsync project # Copy the created script into the Sonar server. Use sshpass -f to get the password from the file sshpass -f /opt/sonarQubeServerPass scp "$(pwd)/$inlineScriptForReport" dnavaei@192.168.10.41:~/ # ssh into the sonar server and run the copied shell script reportAddress=$(sshpass -f /opt/sonarQubeServerPass ssh -t dnavaei@192.168.10.41 ./"$inlineScriptForReport" "$sonarRunCloudSyncProject") + reportAddress=${reportAddress/.docx/.md} + sshpass -f /opt/sonarQubeServerPass scp dnavaei@192.168.10.41:"$reportAddress" "$REPORT_DIR" echo "Sonar created file: $reportAddress" # Copy the created SonarQube file from the sonar server to the remote directory sshpass -f /opt/sonarQubeServerPass scp dnavaei@192.168.10.41:"$reportAddress" "$REPORT_DIR" + mapfile -t nameOfReports < <(find "$REPORT_DIR" -iname '*.md') + for report in "${nameOfReports[@]}" + do + ehco "This file was found: $report" + local status="" + local sonarStatus=$(grep "| Quality Gate Status | ERROR |" "$report") + if [[ -z "$sonarStatus" ]]; then status="Passed"; else status="Failed"; fi + + if [[ "$report" == *"$sonarRunUIProject"* ]] + then + ehco "UI SonarQube Result:,$status" >> "$STATUS_REPORT" + elif [[ "$report" == *"$sonarRunCloudSyncProject"* ]] + then + ehco "Cloudsync SonarQube Result:,$status" >> "$STATUS_REPORT" + fi + done + # Done with the sonar operations, go back to the upper address cd "$currentDir" || return }