[ 
https://issues.apache.org/jira/browse/HIVE-26196?focusedWorklogId=799921&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-799921
 ]

ASF GitHub Bot logged work on HIVE-26196:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Aug/22 08:49
            Start Date: 11/Aug/22 08:49
    Worklog Time Spent: 10m 
      Work Description: asolimando commented on code in PR #3254:
URL: https://github.com/apache/hive/pull/3254#discussion_r943246071


##########
Jenkinsfile:
##########
@@ -304,6 +304,53 @@ tar -xzf 
packaging/target/apache-hive-*-nightly-*-src.tar.gz
         }
       }
   }
+  branches['sonar'] = {
+      executorNode {
+          if(env.CHANGE_BRANCH == 'master') {
+              stage('Prepare') {
+                  loadWS();
+              }
+              stage('Sonar') {
+                  withCredentials([string(credentialsId: 'sonar', variable: 
'SONAR_TOKEN')]) {
+                      sh """#!/bin/bash -e
+                      sw java 11 && . /etc/profile.d/java.sh
+                      export MAVEN_OPTS=-Xmx5G
+                      mvn 
org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar \
+                       -Dsonar.organization=apache \
+                       -Dsonar.projectKey=apache_hive \
+                       -Dsonar.host.url=https://sonarcloud.io \
+                       -Dsonar.branch.name=${CHANGE_BRANCH} \
+                       -DskipTests -Dit.skipTests -Dmaven.javadoc.skip
+                      """
+                 }
+              }
+          } else if(env.CHANGE_ID) {
+              stage('Prepare') {
+                  loadWS();
+              }
+              stage('Sonar') {
+                  withCredentials([string(credentialsId: 'sonar', variable: 
'SONAR_TOKEN')]) {
+                      sh """#!/bin/bash -e
+                      sw java 11 && . /etc/profile.d/java.sh
+                      export MAVEN_OPTS=-Xmx5G
+                      mvn 
org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar \
+                       -Dsonar.organization=apache \
+                       -Dsonar.projectKey=apache_hive \
+                       -Dsonar.host.url=https://sonarcloud.io \
+                       -Dsonar.pullrequest.github.repository=apache/hive \
+                       -Dsonar.pullrequest.key=${CHANGE_ID} \
+                       -Dsonar.pullrequest.branch=${CHANGE_BRANCH} \
+                       -Dsonar.pullrequest.base=${CHANGE_TARGET} \
+                       -Dsonar.pullrequest.provider=GitHub \
+                       -DskipTests -Dit.skipTests -Dmaven.javadoc.skip
+                      """
+                 }

Review Comment:
   I have unified the common pieces and created a parameterized function to run 
sonar analysis, current run is still on-going but the sonar task has already 
successfully completed





Issue Time Tracking
-------------------

    Worklog Id:     (was: 799921)
    Time Spent: 2h 20m  (was: 2h 10m)

> Integrate Sonar analysis for the master branch and PRs
> ------------------------------------------------------
>
>                 Key: HIVE-26196
>                 URL: https://issues.apache.org/jira/browse/HIVE-26196
>             Project: Hive
>          Issue Type: Improvement
>          Components: Build Infrastructure
>    Affects Versions: 4.0.0-alpha-2
>            Reporter: Alessandro Solimando
>            Assignee: Alessandro Solimando
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> The aim of the ticket is to integrate SonarCloud analysis for the master 
> branch and PRs.
> The ticket does not cover test coverage at the moment (it can be added in 
> follow-up tickets, if there is enough interest).
> From preliminary tests, the analysis step requires 30 additional minutes for 
> the pipeline, but this step is run in parallel with the test run, so the 
> total end-to-end run-time is not affected.
> The idea for this first integration is to track code quality metrics over new 
> commits in the master branch and for PRs, without any quality gate rules 
> (i.e., the analysis will never fail, independently of the values of the 
> quality metrics).
> An example of analysis is available in the ASF Sonar account for Hive: [PR 
> analysis|https://sonarcloud.io/summary/new_code?id=apache_hive&pullRequest=3254]
> After integrating the changes, PRs will also be decorated with a link to the 
> analysis to be able to better evaluate any pain points of the contribution at 
> an earlier stage, making the life of the reviewers a bit easier.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to