• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • influxdb-plugin
    • None
    • Jenkins 2.222.3
      influxdb-plugin 2.3
      mstest (plugin) 1.0.0
      junit (plugin) 1.29
      influxdb (target) 1.7.10


      multi-branch pipelines with bitbucket source
    • 3.6.1

      Although I can see the changeset available in the Job run, as well as test results, no changelog_data or junit_data is published to influxdb.

      Our jobs are multibranch pipelines with Bitbucket Source.
      Pipelines are declarative as jenkinsfiles in the git repos themselves 

      I tried with global listener and through the influxDbPublisher.
      Test result in trx files that get converted to unit using mstest plugin 
      Although there are changes and test picked up by Jenkins in the job page, looking ate the influx plugin log messages I always get:

      Data source empty: Change Log

      Plugin skipped: JUnit

      jenkins_data, jenkins_custom_data, customDataMaps and jenkinsEnvParameterField all working correctly.

          [JENKINS-62277] Plugin does not publish changelog_data

          Random Dev added a comment -

          further info, just checked and I can get the test details with this function on post stage of  the pipeline 

          def get_test_results(){  def job = Jenkins.instance.getItemByFullName("${env.JOB_NAME}");  def build = job.getLastBuild()  println("Build Number: ${build.number}")  if (build.getAction(hudson.tasks.junit.TestResultAction.class) == null) {    println("No tests")    return ("No Tests")  }
            def total_count  =  build.getAction(hudson.tasks.junit.TestResultAction.class).getTotalCount();  def failed_count = build.getAction(hudson.tasks.junit.TestResultAction.class).getFailCount();  def skipped_count = build.getAction(hudson.tasks.junit.TestResultAction.class).getSkipCount();  def passed_count = total_count - (failed_count + skipped_count)  println("Total Count: ${total_count}")  println("Failed Count: ${failed_count}")  println("Skipped Count: ${skipped_count}")  println("Passed Count: ${passed_count}")
            index = 1
            def result = build.getAction(hudson.tasks.junit.TestResultAction.class).result
            failedTests = result.getFailedTests();
            failedTests.each { test ->    println("test full object: ${test}")    println("------------------------------------")    println("fullName:    ${test.fullDisplayName}\n" +    "index:        ${index}\n" +    "name:         ${test.name}\n" +    "age:          ${test.age}\n" +    "failCount:    ${test.failCount}\n" +    "failedSince:  ${test.failedSince}\n" +    "errorDetails: ${test.errorDetails}\n")    println("------------------------------------")    println("------------------------------------")    index = index + 1  } }
          

          And the changeset details with this function

          def get_changeset(){  script{    def changeset_list= []    def changeLogSets = currentBuild.changeSets    for (int i = 0; i < changeLogSets.size(); i++) {      def entries = changeLogSets[i].items      for (int j = 0; j < entries.length; j++) {        def entry = entries[j]        def changed_files = new ArrayList(entry.affectedFiles)        for (int k = 0; k < changed_files.size(); k++) {          def changed_file = changed_files[k]                     changeset_list.add("${changed_file.path}")        }       }     }     return changeset_list   }}
          

          Random Dev added a comment - further info, just checked and I can get the test details with this function on post stage of  the pipeline  def get_test_results(){ def job = Jenkins.instance.getItemByFullName( "${env.JOB_NAME}" ); def build = job.getLastBuild() println( "Build Number : ${build.number}" ) if (build.getAction(hudson.tasks.junit.TestResultAction.class) == null ) { println( "No tests" ) return ( "No Tests" ) } def total_count = build.getAction(hudson.tasks.junit.TestResultAction.class).getTotalCount(); def failed_count = build.getAction(hudson.tasks.junit.TestResultAction.class).getFailCount(); def skipped_count = build.getAction(hudson.tasks.junit.TestResultAction.class).getSkipCount(); def passed_count = total_count - (failed_count + skipped_count) println( "Total Count: ${total_count}" ) println( "Failed Count: ${failed_count}" ) println( "Skipped Count: ${skipped_count}" ) println( "Passed Count: ${passed_count}" ) index = 1 def result = build.getAction(hudson.tasks.junit.TestResultAction.class).result failedTests = result.getFailedTests(); failedTests.each { test -> println( "test full object: ${test}" ) println( "------------------------------------" ) println( "fullName: ${test.fullDisplayName}\n" + "index: ${index}\n" + "name: ${test.name}\n" + "age: ${test.age}\n" + "failCount: ${test.failCount}\n" + "failedSince: ${test.failedSince}\n" + "errorDetails: ${test.errorDetails}\n" ) println( "------------------------------------" ) println( "------------------------------------" ) index = index + 1 } } And the changeset details with this function def get_changeset(){ script{ def changeset_list= [] def changeLogSets = currentBuild.changeSets for ( int i = 0; i < changeLogSets.size(); i++) { def entries = changeLogSets[i].items for ( int j = 0; j < entries.length; j++) { def entry = entries[j] def changed_files = new ArrayList(entry.affectedFiles) for ( int k = 0; k < changed_files.size(); k++) { def changed_file = changed_files[k] changeset_list.add( "${changed_file.path}" ) } } } return changeset_list }}

          Aleksi Simell added a comment - - edited

          In order to publish junit_data you need to set an environment variable LOG_JUNIT_RESULTS to true as mentioned in PR description. I will update the documentation for that.

          I will need to investigate the changeset data.

          Aleksi Simell added a comment - - edited In order to publish junit_data you need to set an environment variable  LOG_JUNIT_RESULTS  to true as mentioned in  PR description . I will update the documentation for that. I will need to investigate the changeset data.

          Random Dev added a comment - - edited

          Thank you very much, I am now able to get the test data.
          Sorry I did not pay attention to the PR.

          Regarding the changeset data, it is obviously failing to get true here.
          Will put some tests in place as soon as possible

          ChangeLogPointGenerator.java
          
          public boolean hasReport() {
                  if (build instanceof AbstractBuild) {
                      getChangeLog(build);
                      return (this.getCommitCount() > 0);
                  }        
          return false;
              }

           

          Random Dev added a comment - - edited Thank you very much, I am now able to get the test data. Sorry I did not pay attention to the PR. Regarding the changeset data, it is obviously failing to get true here. Will put some tests in place as soon as possible ChangeLogPointGenerator.java public boolean hasReport() { if (build instanceof AbstractBuild) { getChangeLog(build); return ( this .getCommitCount() > 0); } return false ; }  

          Aleksi Simell added a comment -

          one_random_dev Have you managed to get the changelog data to work?

          Aleksi Simell added a comment - one_random_dev Have you managed to get the changelog data to work?

          Random Dev added a comment -

          no, sorry had no time to pick it up yet, I do believe it has something to  do with Bitbucket / multi branch pipeline integration 

          Random Dev added a comment - no, sorry had no time to pick it up yet, I do believe it has something to  do with Bitbucket / multi branch pipeline integration 

          Aleksi Simell added a comment -

          one_random_dev Is this still an issue?

          Aleksi Simell added a comment - one_random_dev Is this still an issue?

          Aleksi Simell added a comment -

          This is finally fixed with this commit. I'm working on getting unit tests for this working before merging and then releasing the fix.

          Aleksi Simell added a comment - This is finally fixed with this commit . I'm working on getting unit tests for this working before merging and then releasing the fix.

          Aleksi Simell added a comment -

          PR merged. Fix will be available in the next release.

          Aleksi Simell added a comment - PR merged . Fix will be available in the next release.

            aleksisimell Aleksi Simell
            one_random_dev Random Dev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: