Index: build/unittest.sh =================================================================== diff -u -r683152d821ba3488f74c9f62152beb0036bf3dd8 -ra2296c8111143737fcba7c0f2d173a3e72a906f7 --- build/unittest.sh (.../unittest.sh) (revision 683152d821ba3488f74c9f62152beb0036bf3dd8) +++ build/unittest.sh (.../unittest.sh) (revision a2296c8111143737fcba7c0f2d173a3e72a906f7) @@ -435,7 +435,8 @@ local sonarFolder="SonarQube" local buildWrapperJson="Build_Wrapper_JSON" local sonarLogs="SonarQubeLogs.log" - local sonarRunProject="UI-manualrun" + local sonarRunUIProject="UI-manualrun" + local sonarRunCloudSyncProject="UI_Cloudsync-manualrun" local inlineScriptForReport="sonarReportGeneration.sh" echo " ------------------------------ Running SonarQube test" # Make a folder for SonarQube operations @@ -464,10 +465,22 @@ cp "$currentDir"/"$sonarFolder"/"$buildWrapperJson"/build-wrapper-dump.json "$(pwd)" # Run sonar command. The password is located in the /opt/ folder in the build server and for the password open that # file and read the first line as the password - /opt/sonar-scanner-4.8.0.2856-linux/bin/sonar-scanner -Dsonar.projectKey="$sonarRunProject" -Dsonar.sources=. \ + /opt/sonar-scanner-4.8.0.2856-linux/bin/sonar-scanner -Dsonar.projectKey="$sonarRunUIProject" -Dsonar.sources=. \ -Dsonar.cfamily.build-wrapper-output=. \ -Dsonar.cfamily.threads=4 -Dsonar.host.url=http://192.168.10.41:9000 \ -Dsonar.login=admin -Dsonar.password="$(head -n 1 /opt/sonarQubeServerPass)" | tee -a "$sonarLogs" + + cd ../cloudsync || return + # Copy the created build wrapper json file into the application folder + cp "$currentDir"/"$sonarFolder"/"$buildWrapperJson"/build-wrapper-dump.json "$(pwd)" + # Run sonar command. The password is located in the /opt/ folder in the build server and for the password open that + # file and read the first line as the password + /opt/sonar-scanner-4.8.0.2856-linux/bin/sonar-scanner -Dsonar.projectKey="$sonarRunCloudSyncProject" \ + -Dsonar.sources=. \ + -Dsonar.cfamily.build-wrapper-output=. \ + -Dsonar.cfamily.threads=4 -Dsonar.host.url=http://192.168.10.41:9000 \ + -Dsonar.login=admin -Dsonar.password="$(head -n 1 /opt/sonarQubeServerPass)" | tee -a "$sonarLogs" + # Copy the sonar logs into the remote build directory cp -r "$sonarLogs" "$REPORT_DIR" @@ -490,14 +503,27 @@ echo 'docxFile=$(find $(pwd) -name "*.docx" | grep "$latestRunDate-$1")' >> "$inlineScriptForReport" # shellcheck disable=SC2016 echo 'echo $docxFile' >> "$inlineScriptForReport" + + # UI 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" "$sonarRunProject") + reportAddress=$(sshpass -f /opt/sonarQubeServerPass ssh -t dnavaei@192.168.10.41 ./"$inlineScriptForReport" "$sonarRunUIProject") 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" + + # 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") + + 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" + # Done with the sonar operations, go back to the upper address cd "$currentDir" || return }