• 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 created issue -
          Dimitar Georgievski made changes -
          Description Original: *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.
          {code:java|title=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/|http://10.73.71.63: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{code}
          I've successfully tested the API token to write metrics to the bucket with
          {code:java}
          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

          {code}

          Please let me know if anything else is needed.
          New: *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.
          {code:java|title=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{code}
          I've successfully tested the API token to write metrics to the bucket with
          {code:java}
          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

          {code}

          Please let me know if anything else is needed.

          Dimitar Georgievski added a comment - - edited

          I was finally able to find a workaround through reading the plugin's code and adjusting the InfluxDB endpoint with the help of its Telegraf's http_listener_v2 input plugin.

          The request path is using the InfluxDB v2 semantics /api/v2/write

          I had to use password without user name to enable basic authentication due to how Jenkins influxdb-plugin is using the credentials with v3.0.

          I found in the code, not in the doc, that the default measurement prefix is jenkins_data. My impression from reading the doc is that default is jenkins_custom_data.

          So, it looks like in the current state the plugin has some mixture of InfluxDB v1 and v2 auth semantics. To enable a true InfluxDB v2.0 integration the Jenkins influxdb-plugin must support API Token authentication.

           

          [[inputs.http_listener_v2]]
            ## Address and port to host HTTP listener on
            service_address = ":8186"
          
            ## maximum duration before timing out read of the request
            read_timeout = "10s"
            ## maximum duration before timing out write of the response
            write_timeout = "10s"
          
            ## Maximum allowed HTTP request body size in bytes.
            ## 0 means to use the default of 32MiB.
            max_body_size = 0
          
            ## Maximum line size allowed to be sent in bytes.
            ##   deprecated in 1.14; parser now handles lines of unlimited length and option is ignored
            # max_line_size = 0
          
            # http v2
            path = "/api/v2/write"
            data_source = "body"
            data_format = "influx"
          
            ## Set one or more allowed client CA certificate file names to
            ## enable mutually authenticated TLS connections
            # tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
          
            ## Add service certificate and key
            # tls_cert = "/etc/telegraf/cert.pem"
            # tls_key = "/etc/telegraf/key.pem"
          
            ## Optional tag name used to store the database name.
            ## If the write has a database in the query string then it will be kept in this tag name.
            ## This tag can be used in downstream outputs.
            ## The default value of nothing means it will be off and the database will not be recorded.
            ## If you have a tag that is the same as the one specified below, and supply a database,
            ## the tag will be overwritten with the database supplied.
            #database_tag = "db"
          
            ## Optional username and password to accept for HTTP basic authentication.
            ## You probably want to make sure you have TLS configured above for this.
            #basic_username = "foobar"
            basic_password = "bar100foo"
          

          Dimitar Georgievski added a comment - - edited I was finally able to find a workaround through reading the plugin's code and adjusting the InfluxDB endpoint with the help of its Telegraf's http_listener_v2 input plugin. The request path is using the InfluxDB v2 semantics /api/v2/write I had to use password without user name to enable basic authentication due to how Jenkins influxdb-plugin is using the credentials with v3.0. I found in the code, not in the doc, that the default measurement prefix is  jenkins_data . My impression from reading the doc is that default is  jenkins_custom_data. So, it looks like in the current state the plugin has some mixture of InfluxDB v1 and v2 auth semantics. To enable a true InfluxDB v2.0 integration the Jenkins influxdb-plugin must support API Token authentication.   [[inputs.http_listener_v2]] ## Address and port to host HTTP listener on service_address = ":8186" ## maximum duration before timing out read of the request read_timeout = "10s" ## maximum duration before timing out write of the response write_timeout = "10s" ## Maximum allowed HTTP request body size in bytes. ## 0 means to use the default of 32MiB. max_body_size = 0 ## Maximum line size allowed to be sent in bytes. ## deprecated in 1.14; parser now handles lines of unlimited length and option is ignored # max_line_size = 0 # http v2 path = "/api/v2/write" data_source = "body" data_format = "influx" ## Set one or more allowed client CA certificate file names to ## enable mutually authenticated TLS connections # tls_allowed_cacerts = [ "/etc/telegraf/clientca.pem" ] ## Add service certificate and key # tls_cert = "/etc/telegraf/cert.pem" # tls_key = "/etc/telegraf/key.pem" ## Optional tag name used to store the database name. ## If the write has a database in the query string then it will be kept in this tag name. ## This tag can be used in downstream outputs. ## The default value of nothing means it will be off and the database will not be recorded. ## If you have a tag that is the same as the one specified below, and supply a database, ## the tag will be overwritten with the database supplied. #database_tag = "db" ## Optional username and password to accept for HTTP basic authentication. ## You probably want to make sure you have TLS configured above for this . #basic_username = "foobar" basic_password = "bar100foo"

          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 made changes -
          Attachment New: jacoco-html-report.png [ 56721 ]

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

              Created:
              Updated:
              Resolved: