• Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • influxdb-plugin
    • None
    • Jenkins 2.289.1
      influxdb-plugin 3.0.2
      InfluxDB v2.0

      Created a global credential

      User name random. My understanding is the plugin 3+ version is ignoring it.

      password: Write API token to the target bucket

      Created InfluxDB target

      Provided org, database (bucket) and retention policy.

      Created a free style job

      using the above target and received unauthorized access error. See the attachment for a snapshot of the configuration.

      401 Unauthorized error
      Started by user unknown or anonymous
      Running as SYSTEM
      Building in workspace /var/jenkins_home/jobs/free-influx/workspace
      [InfluxDB Plugin] Collecting data...
      [InfluxDB Plugin] Publishing data to target 'influxdb_v2' (url='
      [http://influxdb:8086]
      ', database='quality-metrics')
      ERROR: Build step failed with exception
      com.influxdb.exceptions.UnauthorizedException: unauthorized access
      	at com.influxdb.internal.AbstractRestClient.responseToError(AbstractRestClient.java:98)
      	at com.influxdb.internal.AbstractRestClient.execute(AbstractRestClient.java:81)
      	at com.influxdb.client.internal.WriteApiBlockingImpl.write(WriteApiBlockingImpl.java:235)
      	at com.influxdb.client.internal.WriteApiBlockingImpl.lambda$writePoints$1(WriteApiBlockingImpl.java:152)
      	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
      	at com.influxdb.client.internal.WriteApiBlockingImpl.writePoints(WriteApiBlockingImpl.java:152)
      	at com.influxdb.client.internal.WriteApiBlockingImpl.writePoints(WriteApiBlockingImpl.java:136)
      	at jenkinsci.plugins.influxdb.InfluxDbPublicationService.writeToInflux(InfluxDbPublicationService.java:361)
      Caused: jenkinsci.plugins.influxdb.InfluxReportException
      	at jenkinsci.plugins.influxdb.InfluxDbPublicationService.writeToInflux(InfluxDbPublicationService.java:364)
      	at jenkinsci.plugins.influxdb.InfluxDbPublicationService.perform(InfluxDbPublicationService.java:301)
      	at jenkinsci.plugins.influxdb.InfluxDbPublisher.perform(InfluxDbPublisher.java:226)
      	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
      	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
      	at hudson.model.Build$BuildExecution.cleanUp(Build.java:187)
      	at hudson.model.Run.execute(Run.java:1953)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Build step 'Publish build data to InfluxDB' marked build as failure
      Finished: SUCCESS

      I've successfully tested the API token to write metrics to the bucket with

      curl -i -XPOST 'http://influxdb:8086/api/v2/write?org=cortex-org&bucket=quality-metrics&precision=ns' \
          --header 'Authorization: Token ******' \
          --data-raw 'cpu_load_short,host=server01,region=us-west value=0.64 '    
      
      HTTP/1.1 204 No Content
      Date: Thu, 04 Nov 2021 03:05:45 GMT
      
      

      Please let me know if anything else is needed.

          [JENKINS-67051] InfluxDB v2 Authentication fails

          Dimitar Georgievski added a comment - - edited

          I am still having issues to send JaCoCo and SonarQube metrics to InfluxDB. I can confirm they are generated successfully. Unfortunately I am not familiar with the Jenkins SDK to understand why some conditions are failing.

          This is my simple pipeline 

          pipeline {
              agent any    stages {
                  stage('Clone sources') {
                      steps {
                          git url: 'https://github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git'
                      }
                  }        
                  stage('SonarQube analysis') {
                      steps {
                          withSonarQubeEnv('SonarQube') {
                              sh "./gradlew sonarqube -PsonarToken=**********************"
                              step( [ $class: 'JacocoPublisher' ] )
                          }
                      }
                  }
                  stage("Publish to InfluxDB") {
                    steps {
                          influxDbPublisher(selectedTarget: 'influxdb_v2')
                    }
                  }
              }
          }
                   

           

          And this is the output of running it

          Started by user unknown or anonymous
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /var/jenkins_home/jobs/influx-good-code/workspace
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Clone sources)
          [Pipeline] git
          The recommended git tool is: NONE
          No credentials specified
           > git rev-parse --resolve-git-dir /var/jenkins_home/jobs/influx-good-code/workspace/.git # timeout=10
          Fetching changes from the remote Git repository
           > git config remote.origin.url https://github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git # timeout=10
          Fetching upstream changes from https://github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git
           > git --version # timeout=10
           > git --version # 'git version 2.20.1'
           > git fetch --tags --force --progress -- https://github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git +refs/heads/*:refs/remotes/origin/* # timeout=10
           > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
          Checking out Revision ad5ea9b6cd7d090caee6650932c6aa1bb56c24a6 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f ad5ea9b6cd7d090caee6650932c6aa1bb56c24a6 # timeout=10
           > git branch -a -v --no-abbrev # timeout=10
           > git branch -D master # timeout=10
           > git checkout -b master ad5ea9b6cd7d090caee6650932c6aa1bb56c24a6 # timeout=10
          Commit message: "Switched to SQ Token in graddle"
           > git rev-list --no-walk ad5ea9b6cd7d090caee6650932c6aa1bb56c24a6 # timeout=10
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] stage
          [Pipeline] { (SonarQube analysis)
          [Pipeline] withSonarQubeEnv
          Injecting SonarQube environment variables using the configuration: SonarQube
          [Pipeline] {
          [Pipeline] sh
          + ./gradlew sonarqube -PsonarToken=******
          Starting a Gradle Daemon (subsequent builds will be faster)
          > Task :compileJava UP-TO-DATE
          > Task :processResources NO-SOURCE
          > Task :classes UP-TO-DATE
          > Task :compileTestJava UP-TO-DATE
          > Task :processTestResources NO-SOURCE
          > Task :testClasses UP-TO-DATE
          > Task :test UP-TO-DATE
          > Task :jacocoTestReport UP-TO-DATE
          > Task :sonarqube
          
          Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
          
          You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
          
          See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
          
          BUILD SUCCESSFUL in 53s
          5 actionable tasks: 1 executed, 4 up-to-date
          [Pipeline] jacoco
          [JaCoCo plugin] Collecting JaCoCo coverage data...
          [JaCoCo plugin] **/**.exec;**/classes;**/src/main/java; locations are configured
          [JaCoCo plugin] Number of found exec files for pattern **/**.exec: 1
          [JaCoCo plugin] Saving matched execfiles:  /var/jenkins_home/jobs/influx-good-code/workspace/build/jacoco/test.exec
          [JaCoCo plugin] Saving matched class directories for class-pattern: **/classes: 
          [JaCoCo plugin]  - /var/jenkins_home/jobs/influx-good-code/workspace/build/classes 2 files
          [JaCoCo plugin]  - /var/jenkins_home/jobs/influx-good-code/workspace/build/reports/tests/test/classes 0 files
          [JaCoCo plugin] Saving matched source directories for source-pattern: **/src/main/java: 
          [JaCoCo plugin] Source Inclusions: **/*.java,**/*.groovy,**/*.kt,**/*.kts
          [JaCoCo plugin] Source Exclusions: 
          [JaCoCo plugin] - /var/jenkins_home/jobs/influx-good-code/workspace/src/main/java 1 files
          [JaCoCo plugin] Loading inclusions files..
          [JaCoCo plugin] inclusions: []
          [JaCoCo plugin] exclusions: []
          [JaCoCo plugin] Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]
          [JaCoCo plugin] Publishing the results..
          [JaCoCo plugin] Loading packages..
          [JaCoCo plugin] Done.
          [JaCoCo plugin] Overall coverage: class: 100.0, method: 83.33333, line: 88.88889, branch: 100.0, instruction: 87.878784, complexity: 83.33333
          [Pipeline] }
          [Pipeline] // withSonarQubeEnv
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] stage
          [Pipeline] { (Publish to InfluxDB)
          [Pipeline] influxDbPublisher
          [InfluxDB Plugin] Collecting data...
          [InfluxDB Plugin] Publishing data to target 'influxdb_v2' (url='http://10.73.71.63:8186/', database='quality-metrics')
          [InfluxDB Plugin] Completed.
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS 

           

          For some reason I don't see these steps executed

          1 JaCoCo - https://github.com/jenkinsci/influxdb-plugin/blob/7bd05a38cecc1e17ccca73eca975c72e307ea826/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublicationService.java#L218-L221

          2. SonarQube: https://github.com/jenkinsci/influxdb-plugin/blob/7bd05a38cecc1e17ccca73eca975c72e307ea826/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublicationService.java#L245-L249

          Dimitar Georgievski added a comment - - edited I am still having issues to send JaCoCo and SonarQube metrics to InfluxDB. I can confirm they are generated successfully. Unfortunately I am not familiar with the Jenkins SDK to understand why some conditions are failing. This is my simple pipeline  pipeline { agent any stages { stage( 'Clone sources' ) { steps { git url: 'https: //github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git' } } stage( 'SonarQube analysis' ) { steps { withSonarQubeEnv( 'SonarQube' ) { sh "./gradlew sonarqube -PsonarToken=**********************" step( [ $class: 'JacocoPublisher' ] ) } } } stage( "Publish to InfluxDB" ) { steps { influxDbPublisher(selectedTarget: 'influxdb_v2' ) } } } }   And this is the output of running it Started by user unknown or anonymous [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in / var /jenkins_home/jobs/influx-good-code/workspace [Pipeline] { [Pipeline] stage [Pipeline] { (Clone sources) [Pipeline] git The recommended git tool is: NONE No credentials specified > git rev-parse --resolve-git-dir / var /jenkins_home/jobs/influx-good-code/workspace/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url https: //github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git # timeout=10 Fetching upstream changes from https: //github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git > git --version # timeout=10 > git --version # 'git version 2.20.1' > git fetch --tags --force --progress -- https: //github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git +refs/heads/*:refs/remotes/origin/* # timeout=10 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision ad5ea9b6cd7d090caee6650932c6aa1bb56c24a6 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f ad5ea9b6cd7d090caee6650932c6aa1bb56c24a6 # timeout=10 > git branch -a -v --no-abbrev # timeout=10 > git branch -D master # timeout=10 > git checkout -b master ad5ea9b6cd7d090caee6650932c6aa1bb56c24a6 # timeout=10 Commit message: "Switched to SQ Token in graddle" > git rev-list --no-walk ad5ea9b6cd7d090caee6650932c6aa1bb56c24a6 # timeout=10 [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (SonarQube analysis) [Pipeline] withSonarQubeEnv Injecting SonarQube environment variables using the configuration: SonarQube [Pipeline] { [Pipeline] sh + ./gradlew sonarqube -PsonarToken=****** Starting a Gradle Daemon (subsequent builds will be faster) > Task :compileJava UP-TO-DATE > Task :processResources NO-SOURCE > Task :classes UP-TO-DATE > Task :compileTestJava UP-TO-DATE > Task :processTestResources NO-SOURCE > Task :testClasses UP-TO-DATE > Task :test UP-TO-DATE > Task :jacocoTestReport UP-TO-DATE > Task :sonarqube Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https: //docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 53s 5 actionable tasks: 1 executed, 4 up-to-date [Pipeline] jacoco [JaCoCo plugin] Collecting JaCoCo coverage data... [JaCoCo plugin] ** /**.exec;**/ classes;**/src/main/java; locations are configured [JaCoCo plugin] Number of found exec files for pattern **/**.exec: 1 [JaCoCo plugin] Saving matched execfiles: / var /jenkins_home/jobs/influx-good-code/workspace/build/jacoco/test.exec [JaCoCo plugin] Saving matched class directories for class- pattern: **/classes: [JaCoCo plugin] - / var /jenkins_home/jobs/influx-good-code/workspace/build/classes 2 files [JaCoCo plugin] - / var /jenkins_home/jobs/influx-good-code/workspace/build/reports/tests/test/classes 0 files [JaCoCo plugin] Saving matched source directories for source-pattern: **/src/main/java: [JaCoCo plugin] Source Inclusions: ** /*.java,**/ *.groovy,** /*.kt,**/ *.kts [JaCoCo plugin] Source Exclusions: [JaCoCo plugin] - / var /jenkins_home/jobs/influx-good-code/workspace/src/main/java 1 files [JaCoCo plugin] Loading inclusions files.. [JaCoCo plugin] inclusions: [] [JaCoCo plugin] exclusions: [] [JaCoCo plugin] Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0] [JaCoCo plugin] Publishing the results.. [JaCoCo plugin] Loading packages.. [JaCoCo plugin] Done. [JaCoCo plugin] Overall coverage: class: 100.0, method: 83.33333, line: 88.88889, branch: 100.0, instruction: 87.878784, complexity: 83.33333 [Pipeline] } [Pipeline] // withSonarQubeEnv [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Publish to InfluxDB) [Pipeline] influxDbPublisher [InfluxDB Plugin] Collecting data... [InfluxDB Plugin] Publishing data to target 'influxdb_v2' (url= 'http: //10.73.71.63:8186/' , database= 'quality-metrics' ) [InfluxDB Plugin] Completed. [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS   For some reason I don't see these steps executed 1 JaCoCo - https://github.com/jenkinsci/influxdb-plugin/blob/7bd05a38cecc1e17ccca73eca975c72e307ea826/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublicationService.java#L218-L221 2. SonarQube:  https://github.com/jenkinsci/influxdb-plugin/blob/7bd05a38cecc1e17ccca73eca975c72e307ea826/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublicationService.java#L245-L249

          Aleksi Simell added a comment - - edited

          Hi dgeorgievski,

          Yes, the plugin doesn't support API token yet and it has it's own ticket already as in on the backlog: JENKINS-65830.

          jenkins_data is the name for a standard Jenkins data (so it's not a prefix, it's an actual metric), such as build_time, build_result, etc. jenkins_custom_data is the default name for any custom data you want to send to InfluxDB, such as high_fives_given, hours_slept, etc. I tried to read the docs, but I didn't find any mention that jenkins_custom_data would be the default. Maybe wording in the documentation could be improved. Also, as in the available metric documentation jenkins_data is one of the few metrics that doesn't require an additional plugin, but it also doesn't list jenkins_custom_data at all, because... well... it's custom and not sent to InfluxDB at all unless specified separately.

          I'm having issues with my dev environment after OS update, so I will have to come back to your issues with SonarQube and JaCoCo later.

          Aleksi Simell added a comment - - edited Hi dgeorgievski , Yes, the plugin doesn't support API token yet and it has it's own ticket already as in on the backlog: JENKINS-65830 . jenkins_data is the name for a standard Jenkins data (so it's not a prefix, it's an actual metric), such as build_time , build_result , etc. jenkins_custom_data is the default name for any custom data you want to send to InfluxDB, such as high_fives_given , hours_slept , etc. I tried to read the docs, but I didn't find any mention that jenkins_custom_data would be the default. Maybe wording in the documentation could be improved. Also, as in the available metric documentation jenkins_data is one of the few metrics that doesn't require an additional plugin, but it also doesn't list jenkins_custom_data at all, because... well... it's custom and not sent to InfluxDB at all unless specified separately. I'm having issues with my dev environment after OS update, so I will have to come back to your issues with SonarQube and JaCoCo later.

          Hi aleksisimell,

          My apologies. I've provided a lots of information but it looks like I forgot to mention what works. I am able to send the build metrics through jenkins_data measurement. Custom metrics worked as well. 

          But, I'm really interested currently in retrieving the SonarQube and JaCoCo metrics.

          The documentation could always be improved and I am more than happy to help with feedback. Any good reference you could recommend on development Jenkins plugins?

          Dimitar Georgievski added a comment - Hi aleksisimell , My apologies. I've provided a lots of information but it looks like I forgot to mention what works. I am able to send the build metrics through  jenkins_data measurement. Custom metrics worked as well.  But, I'm really interested currently in retrieving the SonarQube and JaCoCo metrics. The documentation could always be improved and I am more than happy to help with feedback. Any good reference you could recommend on development Jenkins plugins?

          There is a Developer Guide for Jenkins.

          Kalle Niemitalo added a comment - There is a Developer Guide for Jenkins.

          Aleksi Simell added a comment -

          Hi dgeorgievski

          I cannot reproduce not being able to send JaCoCo or SonarQube data. How is your job configured? What versions of each plugin are you using?

          Aleksi Simell added a comment - Hi dgeorgievski I cannot reproduce not being able to send JaCoCo or SonarQube data. How is your job configured? What versions of each plugin are you using?

          Dimitar Georgievski added a comment - - edited

          I am using this project and graddle build configuration to test influxdb plugin:

          https://github.com/dgeorgievski/sonarqube-jacoco-code-coverage/blob/master/build.gradle

          Jenkins plugins versions:

          JaCoCo = 3.3.0

          SonarQube Scanner for Jenkins = 2.13.1

           

          The following is a screen shot of the JaCoCo html report from the last job run

          Dimitar Georgievski added a comment - - edited I am using this project and graddle build configuration to test influxdb plugin: https://github.com/dgeorgievski/sonarqube-jacoco-code-coverage/blob/master/build.gradle Jenkins plugins versions: JaCoCo = 3.3.0 SonarQube Scanner for Jenkins = 2.13.1   The following is a screen shot of the JaCoCo html report from the last job run

          Dimitar Georgievski added a comment - - edited

          By reading the InfluxDB plugin code and JaCoCo documentation I was able to enable publishing of JaCoCo measurements with the following pipeline

          pipeline {
              agent any    
          
              stages {
                  stage('Clone sources') {
                      steps {
                          git url: 'https://github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git'
                      }
                  }        stage('Build') {
                      steps {
                          sh './gradlew clean test build'
                          junit 'build/test-results/test/*.xml'
                          step( [ $class: 'JacocoPublisher' ] )
                      }
                  }
               
                  stage('SonarQube analysis') {
                      steps {
                          withSonarQubeEnv('SonarQube') {
                              sh "./gradlew sonarqube -PsonarToken=************"
                          }
                      }
                  }
                  
                  stage("InfluxDB v2 publisher") {
                      steps {
                          withSonarQubeEnv('SonarQube') {
                              influxDbPublisher(selectedTarget: 'influxdb_v2')
                          }
                      }
                  }
                  
              }
          }
                   

           

          Which produced now

          [Pipeline] influxDbPublisher
          [InfluxDB Plugin] Collecting data...
          [InfluxDB Plugin] JaCoCo data found. Writing to InfluxDB...
          [InfluxDB Plugin] Publishing data to target 'influxdb_v2' (url='http://10.73.71.63:8186/', database='quality-metrics')
          [InfluxDB Plugin] Completed.

          I can see the `jacoco_data` metrics in InfluxDB, which is great.

          SonarQube measurements are still not published. Considering my inexperience with Jenkins plugins it would be the best if you could provide a working example that I could use in my case.

          Dimitar Georgievski added a comment - - edited By reading the InfluxDB plugin code and JaCoCo documentation I was able to enable publishing of JaCoCo measurements with the following pipeline pipeline { agent any stages { stage( 'Clone sources' ) { steps { git url: 'https: //github.com/dgeorgievski/sonarqube-jacoco-code-coverage.git' } } stage( 'Build' ) { steps { sh './gradlew clean test build' junit 'build/test-results/test/*.xml' step( [ $class: 'JacocoPublisher' ] ) } } stage( 'SonarQube analysis' ) { steps { withSonarQubeEnv( 'SonarQube' ) { sh "./gradlew sonarqube -PsonarToken=************" } } } stage( "InfluxDB v2 publisher" ) { steps { withSonarQubeEnv( 'SonarQube' ) { influxDbPublisher(selectedTarget: 'influxdb_v2' ) } } } } }   Which produced now [Pipeline] influxDbPublisher [InfluxDB Plugin] Collecting data... [InfluxDB Plugin] JaCoCo data found. Writing to InfluxDB... [InfluxDB Plugin] Publishing data to target 'influxdb_v2' (url= 'http: //10.73.71.63:8186/' , database= 'quality-metrics' ) [InfluxDB Plugin] Completed. I can see the `jacoco_data` metrics in InfluxDB, which is great. SonarQube measurements are still not published. Considering my inexperience with Jenkins plugins it would be the best if you could provide a working example that I could use in my case.

          This info might help in resolving SonarQube integration issue

           

          SonarQube logs confirming the results were submitted by the Jenkins job

          2021.11.09 19:04:40 INFO  ce[AX0GFl2GCxGqDPUI8dNM][o.s.c.t.s.ComputationStepExecutor] Publish task results | status=SUCCESS | time=0ms
          2021.11.09 19:04:40 INFO  ce[AX0GFl2GCxGqDPUI8dNM][o.s.c.t.s.ComputationStepExecutor] Trigger refresh of Portfolios and Applications | status=SUCCESS | time=1ms
          2021.11.09 19:04:40 INFO  ce[AX0GFl2GCxGqDPUI8dNM][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Webhooks | globalWebhooks=1 | projectWebhooks=0 | status=SUCCESS | time=135ms
          2021.11.09 19:04:40 INFO  ce[AX0GFl2GCxGqDPUI8dNM][o.s.c.t.CeWorkerImpl] Executed task | project=com.tom:sonarqube-jacoco-code-coverage | type=REPORT | id=AX0GFl2GCxGqDPUI8dNM | submitter=jenkins | status=SUCCESS | time=9717ms
          

           

          Jenkins logs confirming the success of the same and the execution of the global Web hook

          2021-11-09 19:03:04.541+0000 [id=1205]	INFO	h.p.sonar.SonarBuildWrapper#setUp: Injecting SonarQube environment variables using the configuration: SonarQube
          2021-11-09 19:03:04.547+0000 [id=1205]	INFO	h.p.sonar.SonarBuildWrapper#createLoggerDecorator: Masking SonarQube passwords
          2021-11-09 19:04:36.186+0000 [id=1235]	INFO	o.j.p.workflow.job.WorkflowRun#finish: influx-good-code #39 completed: SUCCESS
          2021-11-09 19:04:40.144+0000 [id=112]	INFO	o.s.s.j.p.SonarQubeWebHook#doIndex: Received POST from 172.19.0.2
          

           

          Maybe I am wrong but it looks to me the SonarQube metrics publishing is skipped because these two patterns
          https://github.com/jenkinsci/influxdb-plugin/blob/7bd05a38cecc1e17ccca73eca975c72e307ea826/src/main/java/jenkinsci/plugins/influxdb/generators/SonarQubePointGenerator.java#L52-L54

          are missing in the Jenkins log file
          https://github.com/jenkinsci/influxdb-plugin/blob/7bd05a38cecc1e17ccca73eca975c72e307ea826/src/main/java/jenkinsci/plugins/influxdb/generators/SonarQubePointGenerator.java#L260-L276

          Dimitar Georgievski added a comment - This info might help in resolving SonarQube integration issue   SonarQube logs confirming the results were submitted by the Jenkins job 2021.11.09 19:04:40 INFO ce[AX0GFl2GCxGqDPUI8dNM][o.s.c.t.s.ComputationStepExecutor] Publish task results | status=SUCCESS | time=0ms 2021.11.09 19:04:40 INFO ce[AX0GFl2GCxGqDPUI8dNM][o.s.c.t.s.ComputationStepExecutor] Trigger refresh of Portfolios and Applications | status=SUCCESS | time=1ms 2021.11.09 19:04:40 INFO ce[AX0GFl2GCxGqDPUI8dNM][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Webhooks | globalWebhooks=1 | projectWebhooks=0 | status=SUCCESS | time=135ms 2021.11.09 19:04:40 INFO ce[AX0GFl2GCxGqDPUI8dNM][o.s.c.t.CeWorkerImpl] Executed task | project=com.tom:sonarqube-jacoco-code-coverage | type=REPORT | id=AX0GFl2GCxGqDPUI8dNM | submitter=jenkins | status=SUCCESS | time=9717ms   Jenkins logs confirming the success of the same and the execution of the global Web hook 2021-11-09 19:03:04.541+0000 [id=1205] INFO h.p.sonar.SonarBuildWrapper#setUp: Injecting SonarQube environment variables using the configuration: SonarQube 2021-11-09 19:03:04.547+0000 [id=1205] INFO h.p.sonar.SonarBuildWrapper#createLoggerDecorator: Masking SonarQube passwords 2021-11-09 19:04:36.186+0000 [id=1235] INFO o.j.p.workflow.job.WorkflowRun#finish: influx-good-code #39 completed: SUCCESS 2021-11-09 19:04:40.144+0000 [id=112] INFO o.s.s.j.p.SonarQubeWebHook#doIndex: Received POST from 172.19.0.2   Maybe I am wrong but it looks to me the SonarQube metrics publishing is skipped because these two patterns https://github.com/jenkinsci/influxdb-plugin/blob/7bd05a38cecc1e17ccca73eca975c72e307ea826/src/main/java/jenkinsci/plugins/influxdb/generators/SonarQubePointGenerator.java#L52-L54 are missing in the Jenkins log file https://github.com/jenkinsci/influxdb-plugin/blob/7bd05a38cecc1e17ccca73eca975c72e307ea826/src/main/java/jenkinsci/plugins/influxdb/generators/SonarQubePointGenerator.java#L260-L276

          Dimitar Georgievski added a comment - - edited

          I am able now to manage the plugin life-cycle and debug the code.

          As suspected, collecting of the info about Sonar issues and metrics fails because the plugin expects to find the required Sonar task details in the pipeline build logs.

          This information is stored in ${WORKSPACE}/build/sonar/report-task.txt 

          projectKey=com.tom:sonarqube-jacoco-code-coverage
          serverUrl=http://localhost:9000serverVersion=8.9.3.48735
          http://localhost:9000serverVersion=8.9.3.48735
          dashboardUrl=http://localhost:9000/dashboard?id=com.tom%3Asonarqube-jacoco-code-coverage
          ceTaskId=AX0vnvr4_QGKX8b7Yz_v
          ceTaskUrl=http://localhost:9000/api/ce/task?id=AX0vnvr4_QGKX8b7Yz_v
          

           
          I am able to parse this file and communicate with the Sonar server, but need to go through testing and verification. It looks like I'd need to verify the syntax of Sonar API calls. The plugin seems to be using a deprecated syntax.

          This ticket served its purpose and it could be closed. I plan to open a PR in the repo after I am done with the testing. 

          Dimitar Georgievski added a comment - - edited I am able now to manage the plugin life-cycle and debug the code. As suspected, collecting of the info about Sonar issues and metrics fails because the plugin expects to find the required Sonar task details in the pipeline build logs. This information is stored in ${WORKSPACE}/build/sonar/report-task.txt  projectKey=com.tom:sonarqube-jacoco-code-coverage serverUrl=http: //localhost:9000serverVersion=8.9.3.48735 http: //localhost:9000serverVersion=8.9.3.48735 dashboardUrl=http: //localhost:9000/dashboard?id=com.tom%3Asonarqube-jacoco-code-coverage ceTaskId=AX0vnvr4_QGKX8b7Yz_v ceTaskUrl=http: //localhost:9000/api/ce/task?id=AX0vnvr4_QGKX8b7Yz_v   I am able to parse this file and communicate with the Sonar server, but need to go through testing and verification. It looks like I'd need to verify the syntax of Sonar API calls. The plugin seems to be using a deprecated syntax. This ticket served its purpose and it could be closed. I plan to open a PR in the repo after I am done with the testing. 

          There is a work around for the authentication even with this version of influxdb plugin.

          I'll try to contribute fixes for other discovered issues in the repo of the project.

          Dimitar Georgievski added a comment - There is a work around for the authentication even with this version of influxdb plugin. I'll try to contribute fixes for other discovered issues in the repo of the project.

            aleksisimell Aleksi Simell
            dgeorgievski Dimitar Georgievski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: